简体   繁体   English

系统数据SqlClient SqlException

[英]System Data SqlClient SqlException

I have to execute an updating query : 我必须执行一个更新查询:

 using (SqlCommand sqlCmd = new SqlCommand("UPDATE  Test SET Testedpiece = Testedpiece + 1 and Rate = (Testedpiece  * 100) / Totalpiece  WHERE IDSuperlot = @super", connexion))

But i have this error System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near the keyword 'and'. 但是我有这个错误System.Data.SqlClient.SqlException (0x80131904): Incorrect syntax near the keyword 'and'.

I don't know why this error appears and how can i fix it 我不知道为什么会出现此错误,我该如何解决

  1. What is the Sql Syntax error? 什么是Sql语法错误?
  2. How can i fix it? 我该如何解决?

Your sql command starts like this: 您的sql命令开始如下:

UPDATE  Test SET Testedpiece = Testedpiece + 1 and Rate = ...

change it to this: 更改为此:

UPDATE  Test SET Testedpiece = Testedpiece + 1, Rate = ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM