command3 = New Data.SqlClient.SqlCommand("UPDATE Products SET Stock=" + numU + " Where ProductName='" + proName + "'", connection3)
At the code snippet above, numU is integer and when i execute it in insert at sql server as a double so it throws me an error and says me that its a double and you try to put in integer ...
Why this happens? how can avoid this error?
I ahve visual studio 2005 and when i put my cursor on numU says Dim numU as integer and when i put the cursor to + it says me double...
Software/Hardware used:
ASKED:
June 5, 2009 9:19 AM
UPDATED:
December 15, 2010 11:11 PM
I would put the constructed update statement in a string variable, and display it before adding it to the sqlCommand, to see how it looks.
Have you tried executing the command with a fixed number ? (for example “UPDATE Products SET Stock= 100 Where ProductName=’” + proName + “‘”)
Could you post the exact error message ?