这是我的 SQL 语句:
UPDATE InboxItem
SET OrderId = @0, Item = @1, Quantity = @2, Price = @3,
Memo = "", InboxId = @4, VATId = @5
WHERE Id = @6
这会抛出SqlException
,表示
An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as \"\" or [] are not allowed. Change the alias to a valid name.
我想我知道问题出在哪里了。如果我给 Memo 赋值,一切都很好。但是,有时我希望 memo 为空字符串。如何做到这一点?
最佳答案
使用 ''
而不是 ""
。还要验证您的输入是否已正确转义(可能其中一个字符串中有一个未转义的逗号)。
关于c# - 在数据库中更新抛出 SqlException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10757280/