我试图存储2列并将其检索回来
column1 -> string
column2 - > UInt32
那么如何使用C#在sqlite中存储和检索它们?
我想调用column1引用它的column2而没有任何问题。
Sample 1
select column1 from table1 where column2 = {this.UInt32_data}
提前感谢
答案 0 :(得分:0)
使用此功能从 sqlite
中检索数据public DataTable fillDataTable(string sqlCommand)
{
DataTable dt = new DataTable();
String config = "your connection string";
using (var con = new SQLiteConnection { ConnectionString = config })
{
using (var command = new SQLiteCommand { Connection = con })
{
if (con.State == ConnectionState.Open)
con.Close();
con.Open();
command.CommandText = sqlCommand;
dt.Load(command.ExecuteReader());
}
return dt;
}
}