什么是这个代码错误的查询,错误
String updateCmd = String.Format(@"UPDATE [admins]
SET [authority type] = '{0}',
SET [signature] = N'{1}',
SET [message] = N'{2}'
WHERE '{3}'", authorityType, signature, msg, condition);
什么是这个代码错误的查询,错误
String updateCmd = String.Format(@"UPDATE [admins]
SET [authority type] = '{0}',
SET [signature] = N'{1}',
SET [message] = N'{2}'
WHERE '{3}'", authorityType, signature, msg, condition);
错误的事情,你应该只UPDATE
语句中使用一个SET
条款“附近的SET语句语法错误”。
UPDATE [admins]
SET [authority type] = '{0}',
[signature] = N'{1}',
[message] = N'{2}'
WHERE '{3}'
一两件事,请做参数化查询以避免SQL Injection
。使用Command
对象。
不要重复SET
String updateCmd = String.Format("UPDATE [admins] SET [authority type] = '{0}',
[signature] = N'{1}', [message] = N'{2}' WHERE '{3}'",
authorityType, signature, msg, condition);
你不需要多集只有一个。
非常感谢:)你是我的男人:) – 2013-02-08 14:22:31
不客气':D' – 2013-02-08 14:23:57