1.我使用的版本System.Data.SQLite 版本 1.0.58.0 x64 .net framework 3.5
2.引用System.Data.SQLite
3.代码测试
using System; using System.Collections.Generic; using System.Data; using System.Data.SQLite; using System.Linq; using System.Text;
namespace ConsoleApp2 { class Program { static void Main(string[] args) { string connectionString = "Data Source=G:/xxxx.db;Initial Catalog=sqlite;Integrated Security=True;Max Pool Size=10;Password=xxxx"; SQLiteConnection sqlLiteConnection = new SQLiteConnection(connectionString); if (sqlLiteConnection.State != System.Data.ConnectionState.Open) { sqlLiteConnection.Open(); string sql = "SELECT * FROM sqlite_master WHERE type='table' "; var cmd = new SQLiteCommand(sql, sqlLiteConnection); cmd.CommandText = sql; StringBuilder tableNames = new StringBuilder(); using (SQLiteDataAdapter ap = new SQLiteDataAdapter(sql, sqlLiteConnection)) { DataSet ds = new DataSet(); ap.Fill(ds); DataTable dt = ds.Tables[0]; } } sqlLiteConnection.Close(); } } }
4.System.Data.SQLite版本
下载地址 https://master.dl.sourceforge.net/project/sqlite-dotnet2/OldFiles/SQLite-1.0.58.0-binaries.zip?viasf=1