資源簡介
C#簡單連接查詢sqlite數據庫實例
代碼片段和文件信息
using?System;
using?System.Data.SQLite;
namespace?DataValidator
{
???
????class?Program
????{
????????static?void?Main(string[]?args)
????????{
????????????SQLiteConnection?con?=?new?SQLiteConnection(@“DataSource=D:\B\first.db“);
????????????con.Open();
????????????string?sql?=?“select?*?from?students“;
????????????SQLiteCommand?cmdQ?=?new?SQLiteCommand(sql?con);
????????????SQLiteDataReader?reader?=?cmdQ.ExecuteReader();
????????????while(reader.Read())
????????????{
????????????????Console.WriteLine(reader.GetString(0)?+?“?“?+?reader.GetInt32(1)?+?“?“);
????????????}
????????????con.Close();
????????????
????????}
???????
????}
}
- 上一篇:C#控制雷賽驅動器單軸點位運動
- 下一篇:科大訊飛語音轉換
評論
共有 條評論