以下查询给出了错误的语法错误
dt = sFunctions.ExecuteQuery(Variables.con, "House_Machinery", "usp_housemachinery_Master_insert" + Id + ",'" + txtItemName.Text + "'," + txthp.Text + "," + txtrate.Text + "," + Variables.sTendercode + "," + Variables.StrResourceHeaderCode);
sFunctions.setSqldbConnCommand_Close(sSqldbCommand);
错误如下:
incorrect syntax near ','
有没有人对我的问题来源有任何见解?
它仍然有同样的错误。
答案 0 :(得分:2)
您在"
之前错过usp_housemachinery_Master_insert"
。
应该是:
sFunctions.ExecuteQuery(Variables.con,
"House_Machinery",
"usp_housemachinery_Master_insert" + ...
请注意,字符串连接是SQL Injection的邀请 - 您应该参数化您的查询。
错误可能来自SQL Server - 您需要确切地检查发送它的内容 - 它可能是无效的SQL,但是如果不知道不同文本框的值,则无法确定。