Friday, March 30, 2012

problem in inserting an integer into a database table

i am using visual web developer 2005 and SQL Express 2005 with VB as the code behind

i want to insert an integer into my database table and this is my code

i = i + 1
productionstatus.UpdateCommand = "UPDATE productionprogressbar SET completedprocess = i WHERE order_id = 10"
productionstatus.Update()

"i" is declared at the top of the page like this

Partial Class production_processlist
Inherits System.Web.UI.Page
Dim i As Integer = 0

when i run the program i get the error

input string is not in the correct format

what is wrong in my code ?

please help me

you are treating your variable "i" as a literal character

try it like this:

"UPDATE productionprogressbar SET completedprocess =" & i.ToString & "WHERE order_id = 10"

No comments:

Post a Comment