This commit is contained in:
sunkaixuan
2017-05-21 14:09:37 +08:00
parent 14302cb959
commit 99a08b10ba

View File

@@ -72,13 +72,20 @@ new List<SugarParameter>() {
}, t5.Key, t5.Value, "Insert t5 error"
);
//Use Lock
var s6 =db.Insertable(insertObj).With(SqlWith.UpdLock).ToSql();
var t6 =db.Insertable(insertObj).With(SqlWith.UpdLock).ToSql();
base.Check(@"INSERT INTO [Student] WITH(UPDLOCK)
([SchoolId],[Name],[CreateTime],[TestId])
VALUES
(@SchoolId,@Name,@CreateTime,@TestId) ;SELECT SCOPE_IDENTITY();",
new List<SugarParameter>() {
new SugarParameter("@SchoolId",0),
new SugarParameter("@CreateTime",Convert.ToDateTime("2010-1-1")),
new SugarParameter("@Name","jack"),
new SugarParameter("@TestId",0)
}, t6.Key, t6.Value, "Insert t6 error"
);
//ToSql
var s7= db.Insertable(insertObj).With(SqlWith.UpdLock)
.InsertColumns(it => new { it.Name }).ToSql();
var s8 = db.Insertable(insertObj).Where(true/* Is insert null */, true/*off identity*/).ToSql();