【发布时间】:2011-09-18 04:38:58
【问题描述】:
我想将 System.Data.SQLite 与 wpf 应用程序一起使用。 所以我下载了文件here 并添加了对下载的 System.Data.SQLite 的引用。
然后我写代码
SQLiteConnection connex = new SQLiteConnection(@"Data Source=C:\Users\Toto\Desktop\Test.sqlite;");
connex.Open();
DataTable dt = new DataTable();
SQLiteCommand command = connex.CreateCommand();
command.CommandText = "SELECT * FROM TEST";
SQLiteDataAdapter da = new SQLiteDataAdapter();
da.SelectCommand = command;
da.Fill(dt);
connex.Close();
但它不起作用..当我尝试打开连接时,它说找不到 SQLite.Interop.dll ..没问题我有这个但无法添加对它的引用,因为它是一个非托管 DLL。
所以,如果有人习惯使用 SQLite 和 ADO.NET,我正在寻求建议..
非常感谢
【问题讨论】:
-
您应该使用
using语句关闭您的连接 -
我知道谢谢这只是为了测试..