在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);
问题解决了:原来是我没有提交交易。