常用SQLite查询语句

打开数据库:

SQLiteConnection db = null;
private string fileName = "System.DB";
if (db == null)
{
    db = new SQLiteConnection(fileName);
    db.Open();
 }            

建表:

SQLiteCommand cmd = db.CreateCommand("Create table Banji (ClassNumber text,Teacher text,Introduction text)");
int i = cmd.ExecuteNonQuery();

插入数据:

cmd.CommandText = "Insert into Banji (ClassNumber,Teacher,Introduction) values (@ClassNumber,@Teacher,@Introduction)";
rec = cmd.ExecuteNonQuery(banji);

更新数据:

UPDATA Banji SET ClassNumber = '2010' WHERE  ClassNumber ='2011'

 

posted @ 2013-01-16 10:33  hack25  阅读(1858)  评论(0编辑  收藏  举报