gpt4 book ai didi

c# - 系统数据SqlClient SqlException

转载 作者:太空宇宙 更新时间:2023-11-03 18:10:33 25 4
gpt4 key购买 nike

我必须执行一个更新查询:

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


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

我不知道为什么会出现此错误,我该如何解决


什么是Sql语法错误?
我该如何解决?

最佳答案

您的sql命令开始如下:

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


更改为此:

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

关于c# - 系统数据SqlClient SqlException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16472214/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com