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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Error with CFQUERY and INSERT INTO 1

Status
Not open for further replies.

dunskii

Programmer
Joined
Sep 14, 2001
Messages
107
Location
AU
Hi All,

When trying to send info to a table using this code:

<CFQUERY datasource=&quot;demo_site&quot; dbtype=&quot;ODBC&quot; name=&quot;AddBasketItem&quot;>
INSERT INTO basket (order_id, prod_id, qty)
VALUES ('#Cookie.BasketID#', '#Form.ProdID#', 1)
</cfquery>

I am getting the error:

Data type mismatch in criteria expression

Error Code: 22005
 


Have you tried losing the single quotes on Cookie.BasketID
and Form.ProdID ?
If these are numeric in database it will throw an error with the single quotes.

<CFQUERY datasource=&quot;demo_site&quot; dbtype=&quot;ODBC&quot; name=&quot;AddBasketItem&quot;>
INSERT INTO basket (order_id, prod_id, qty)
VALUES (#Cookie.BasketID#, #Form.ProdID#, 1)
</cfquery>


 
thanks for your fast reply, i had tried that...it keeps saying that there is something wrong with the CFQUERY statement not the SQL
 
A data type mismatch is exactly what dallasweb refers to. That is, you have single ticks (valid for &quot;text&quot; datatype) around a value that is being inserted into a field with a &quot;number&quot; datatype. Can you tell us what the datatypes are for the values order_id, prod_id and qty in the database? John Hoarty
jhoarty@quickestore.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top