c#操作sqlite db3数据库

时间:2022-05-18 04:38:03

首先添加引用 System.Data.SQLite.dll,引用只用添加这个,但SQLite.Interop.dll文件必须也和它同时放在Debug目录下

然后可用:

SQLiteConnection conn= new SQLiteConnection($"Data Source={tbFilePath.Text}");                

SQLiteCommand cmd= conn.CreateCommand();

cmd.CommandText = "SELECT * FROM FLIGHT_AIRLINE";

SQLiteDataAdapter adapter = new SQLiteDataAdapter(cmd);                

DataTable data = new DataTable();                

adapter.Fill(data);

 

详细可参见 https://www.cnblogs.com/gosteps/p/5310164.html