c#中怎么连接到sqlite数据库
1个回答
展开全部
下载System.Data.SQLite,安装,并在项目中引用System.Data.SQLite.dll
示例代码
using System.Data.SQLite;
SQLiteConnection cnn = new SQLiteConnection();
cnn.ConnectionString = @"Data Source=mytest.db;Pooling=true;FailIfMissing=false"
cnn.Open();
SQLiteCommand cmd = new SQLiteCommand();
cmd.Connection = cnn;
cmd.CommandText = "SELECT * FROM test";
SQLiteDataAdapter da = new SQLiteDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询