KillPrice.Helper.SQLiteDBHelper.ExecuteDataTable C# (CSharp) Method

ExecuteDataTable() public method

执行一个查询语句,返回一个包含查询结果的DataTable
public ExecuteDataTable ( string sql, SQLiteParameter parameters ) : DataTable
sql string 要执行的查询语句
parameters System.Data.SQLite.SQLiteParameter 执行SQL查询语句所需要的参数,参数必须以它们在SQL语句中的顺序为准
return System.Data.DataTable
        public DataTable ExecuteDataTable(string sql, SQLiteParameter[] parameters)
        {
            using (SQLiteConnection connection = new SQLiteConnection(connectionString))
            {
                using (SQLiteCommand command = new SQLiteCommand(sql, connection))
                {
                    if (parameters != null)
                    {
                        command.Parameters.AddRange(parameters);
                    }
                    SQLiteDataAdapter adapter = new SQLiteDataAdapter(command);
                    DataTable data = new DataTable();
                    adapter.Fill(data);
                    return data;
                }
            }

        }
        /// <summary>