private SQLiteConnection connection;
private SQLiteCommand command;
private SQLiteTransaction transaction;
string sqConnectionString = "ZG.db";
public void ExcuteQuery()
{
connection = new SQLiteConnection("Data source = " + sqConnectionString);
connection.Open();
//建立数据库并连接
command = connection.CreateCommand();
transaction = connection.BeginTransaction();
//开启事务
////
command.CommandText = string.Format("INSERT INTO CINFO VALUES(‘0‘,‘1‘,‘2‘,‘3‘,‘4‘)");
command.ExecuteNonQuery();
/////插入语句,可循环插入
transaction.Commit();
//提交事务
command.Dispose();
connection.Dispose();
//结束连接
MessageBox.Show("插入完毕");
}
原文地址:https://www.cnblogs.com/xfbx/p/9276891.html
时间: 2024-10-23 20:46:47