I have the following piece of code handling a form using POST on a classic .asp webpage:
<%
update_LotNo = Replace(Request.Form, "&lotno=", ",")
update_LotNo = Replace(strIDs, "lotno=", "")
update_Qty = Replace(Request.Form, "&qty=", ",")
update_Qty = Replace(strIDs, "qty=", "")
update_Building = Replace(Request.Form, "&bldng=", ",")
update_Building = Replace(strIDs, "bldng=", "")
set DoModify = Server.CreateObject("ADODB.Command")
DoModify.ActiveConnection = MM_StockAccDB_STRING
DoModify.CommandText = "UPDATE tbl_stock_at_locations SET lotno_sal = '" & update_LotNo & "%', building_sal = '" & update_Building & "%', qty_sal = '" & update_Qty & "%' WHERE Lotno_SAL LIKE '" & update_LotNo & "%'"
'DoDelete.CommandType = 1
'DoDelete.CommandTimeout = 0
'DoDelete.Prepared = true
DoModify.Execute()
Response.Redirect("coe_in2.asp?8812901")
%>
This is the error message I get:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]Error converting data type varchar to numeric.
Obviously I'd like as the end result to update the record with the form strings.
I'm new to SQL, so I apologise if this is a very simple question...
tbl_stock_at_locationstable? I suspect that one of the fields you're touching is a numeric type and you're either trying to set it as or compare it to a varchar value. - 3N1GM4response.write DoModify.CommandTextbeforeDoModify.Execute(), to see what is the generated query. You have non numeric values for sure in a numeric field. - DanB