时间:2021-07-01 10:21:17 帮助过:34人阅读
string connString = @"Data Source=D:\sqlite-tools-win32-x86-3180000\hospital.db;Version=3"; SQLiteConnection con = new SQLiteConnection(connString); con.Open(); string query = @"SELECT * FROM Stay"; SQLiteDataAdapter da = new SQLiteDataAdapter(query, con); DataSet ds = new DataSet(); da.Fill(ds, "hello"); this.dataGrid1.DataSource = ds.Tables[0]; //this.dataGrid1.DataMember = "hello"; con.Close();
1. 首先需要引用Sqlite3的.netframe驱动System.Data.SQLite.dll
2. 设计数据库并编入数据,假设这里存在一个Stay的数据表
3. 调用显示代码,结果如下
C# - Sqlite3 实践
标签:nec this stay arp his from http 设计 计数