Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with SQL Insert statement

Status
Not open for further replies.

gmagerr

Technical User
Aug 11, 2001
323
US
Hi guys, i keep getting this error when trying to insert data into my database.

============================================================
Technical Information (for support personnel)

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/Telmon/Intranet/PSS_Old2/InsertMaterial.asp, line 23


Browser Type:
Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

Page:
POST 27 bytes to /Telmon/Intranet/PSS_Old2/InsertMaterial.asp

POST Data:
Qty=1&Submit=Go&productID=1

Time:
Thursday, March 21, 2002, 2:38:43 PM


More information:
Microsoft Support
============================================================

Here's the code

============================================================
<%
Session(&quot;Qty&quot;) = Request(&quot;Qty&quot;)
Session(&quot;ProductID&quot;) = Request(&quot;ProductID&quot;)
Response.Write Session(&quot;ProductID&quot;)

JobCode = Session(&quot;JobCode&quot;)
qty = Session(&quot;Qty&quot;)
prodID = Session(&quot;ProductID&quot;)

strSQL = &quot;INSERT INTO Orders (ProductID, JobCode, Quantity) VALUES ('&quot; & prodID & &quot;', '&quot; & JobCode & &quot;', '&quot; & qty & &quot;')&quot;

Set cnMat = Server.CreateObject(&quot;ADODB.Connection&quot;)
cnMat.Open &quot;DSN=PSS&quot;
cnMat.Execute strSQL

Response.Redirect &quot;DisplayQty.asp&quot;

cnMat.Close
Set cnMat = Nothing
%>
============================================================

i'm trying to insert a quantity, the jobcode and the productID, they are all numbers. help. TIA






 
The syntax of your INSERT statement is causing the numeric values to be treated as strings. Try this instead:
strSQL = &quot;INSERT INTO Orders (ProductID, JobCode, Quantity) VALUES (&quot; & prodID & &quot;, &quot; & JobCode & &quot;, &quot; & qty & &quot;)&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top