Dapper 无法将记录写入 SQL Server

问题描述 投票:0回答:1

在SSMS中手动测试此SQL语句成功地将新记录插入数据库:

INSERT INTO OcrPreset(Id, Binned, BinValue, Blobbed, BlobValue, Inverted, Skewed, SkewValue, Chopped, ChopValue, Name) VALUES(8, 'False', 0, 'False', 5, 'True', 'True', 0, 'True', 0, 'All test')

但是,以下

#C
语句执行没有任何错误,但记录未插入数据库。任何人都可以阐明哪里可能出问题吗?

var sql = "INSERT INTO OcrPreset(Id, Binned, BinValue, Blobbed, BlobValue, Inverted, Skewed, SkewValue, Chopped, ChopValue, Name) VALUES(8, 'False', 0, 'False', 5, 'True', 'True', 0, 'True', 0, 'All test')";
var tmp = this.connection.Execute(sql, transaction: this.transaction);
c# dapper dapper-extensions
1个回答
0
投票

问题解决了:原来是我没有提交交易。

© www.soinside.com 2019 - 2024. All rights reserved.