开发者

Error :No Value gven for more required parameters in vb.net

I have getting erro开发者_Python百科r while update the data to Access db from VB.NET. Which is shown "No value given for more required parameters". Here i have given the code what i have tried.....

con.open()
dim a
dim cd as new oledb.oledbcommand
a="update inward set Quantity=" & textbox3.text & "Where tool_name=" & listbopx1.selectedItemm & ""
cd=new oledb.oledbcommand(a,con)
cd.ExecuteNonQuery()
con.close

Please help me to fix this, I need to know why it has happened.


I think a problem with quotes

a="update inward set Quantity=" & textbox3.text & "Where tool_name=" & listbopx1.selectedItemm & ""

should it not be

a="update inward set Quantity=" & textbox3.text & " Where tool_name='" & listbopx1.selectedItemm & "'"

and watch out for quotes in the string.

So my advice: use parameterized queries,

I added a link to see how to write parameters. Look at : Running a Query, getting a value, then update record in ASP.net (VB)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜