Problem with doing a calculation in an ASP Update statement
My predecessor programmed our Intranet using ASP ages ago. There's code on a form submittal where it's using an Update statement to take away from the number showing in the database:
myConnString = Application("Flash_ConnectionString") Set myConnection = Server.CreateObject("ADODB.Connection")myConnection.Open myConnStringmySql="UPDATE OnHand SET ohnum = ohnum - 1 WHERE ohnum > 0"myConnection.Execute mySQLmyConnection.CloseSet myConnection = Nothing
This works fine but we have since changed things to where the form allows the person to put any number for this item that we still need to subtract from the DB.
To make things easier, I call the value from the form and assign it to the variable s16: s16 = Request.Form("size16")
Then I try to get the Update statement to use my s16 var rather than the static number (mySql="UPDATE OnHand SET ohnum = ohnum - s16 WHERE ohnum > 0") and the web page returns this error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e10'[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1./flash/Confirm.asp, line 233
Some things I do know:
1. Both ohnum and size16 are a Number data type in the Access DB
2. Via a Response.Write Command, I verified that the variable s16 does carry the correct information.
It's probably some kind of text/number mismatch but I cant seem to figure it out.