public static void Insert(string sSerialNo, string sCertData, string sCommonName, string sPwd) { string sConn = PlavyConfig.GetConnectionString("db"); SqlDb db = new SQLiteDb(sConn); var dbFactory = db.DbBuilder.DbFactory; var dbOperator = dbFactory.GetDbParamOperator(); db.BeginTransaction(); var obj = db.Insert <Certificate>(new Certificate() { SerialNo = sSerialNo, CommonName = sCommonName, CertData = sCertData, CertPwd = sPwd, Udt = DateTime.Now }); db.CommitTransaction(); }
/// <summary> /// 写入数据 /// </summary> public void Insert() { SqlDb db = new SQLiteDb(_connString); db.IsShowSqlToConsole = _isShowSqlToConsole; var dbFactory = db.DbBuilder.DbFactory; var dbOperator = dbFactory.GetDbParamOperator(); db.BeginTransaction(); db.IsShowSqlToConsole = _isShowSqlToConsole; for (int i = 1; i <= 20; i++) { db.Insert <UserInfo>(new UserInfo() { UserId = i, UserName = "******" + i.ToString(), Age = 110, Email = "joyet" + i.ToString() + "@qq.com" }); } db.CommitTransaction(); }