sCnd = "INSERT INTO .dbo.Table(Col1, Col2, Col3) Values (1,2,3);
using (DbCommand tempCommand2 = CommandFactory.CreateCommand(db))
{
tempCommand2.CommandText = sCmd;
tempCommand2.ExecuteNonQuery();
}
表还有一个不允许 null 的 Col4。
错误:无法将值 NULL 插入 Col4 列
当我在 Management Studio 中执行 sCmd 时,一切正常。
为什么我会得到异常?