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

update db error using 2000 not xp

Status
Not open for further replies.

twcman

Programmer
Jun 28, 2001
284
US
I have an update into my database using sql not cfupdate. When I execute the update from a winXP workstation, the update goes through fine. When I use a win2000 workstation I get the following error:

Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

Both workstations are using IE 6 and the cf server is MX.

Why the error using win2k and not XP?

Chris Scott
The Whole Computer Medical Systems
 
Form fields:

<input type="HIDDEN" NAME="id" VALUE=#id#>
<input type="HIDDEN" NAME="FName" VALUE="#form.FName#">
<input type="HIDDEN" NAME="LName" VALUE="#form.LName#">
<input type="HIDDEN" NAME="Address1" VALUE="#form.Address1#">
<input type="HIDDEN" NAME="Address2" VALUE="#form.Address2#">
<input type="HIDDEN" NAME="City" VALUE="#form.City#">
<input type="HIDDEN" NAME="State" VALUE="#form.State#">
<input type="HIDDEN" NAME="Zip" VALUE="#form.Zip#">
<input type="HIDDEN" NAME="Country" VALUE="#form.Country#">
<input type="HIDDEN" NAME="Email" VALUE="#form.Email#">
<input type="HIDDEN" NAME="Phone" VALUE="#form.Phone#">
<input type="HIDDEN" NAME="ShipWeight" VALUE="#form.ShipWeight#">
<input type="HIDDEN" NAME="Shipping" VALUE="#form.Shipping#">
<input type="HIDDEN" NAME="OrderID" VALUE=#form.OrderID#>
<input type="HIDDEN" NAME="OrderTotal" VALUE="#OrderTotal#">
<input type="HIDDEN" NAME="GrandTotal" VALUE='#TRIM(NumberFormat(GrandTotal,"999999999.99"))#'>
<input type="HIDDEN" NAME="remembercc" VALUE="off">
<cfif #parameterexists(salestax)#>
<input type="HIDDEN" NAME="salestax" VALUE='#salestax#'>
<cfelse>
<input type="HIDDEN" NAME="salestax" VALUE="">
</cfif>
</cfoutput>

<input type="HIDDEN" NAME="CCNumber_Required" VALUE="Please enter your credit card number">




Update:
UPDATE Customers
SET CustFName='#form.FName#',
CustLName='#form.LName#',
CustPhone='#form.Phone#',
CustEMail='#form.Email#',
CustAddress1='#form.Address1#',
CustAddress2='#form.Address2#',
CustCity='#form.City#',
CustState='#form.State#',
CustZip='#form.Zip#',
CustCountry='#form.Country#',
LastOrderID=#form.OrderID#,
LastOrderDate='#DateFormat(Now(),"MM/DD/YY")#',
LastOrderAmt=#GrandTotal#,
CCName='#form.CCName#',
CCType='#form.CCType#',
CCNum='#form.CCNumber#',
CCExpires='#ccexpires#'
<cfif #form.remembercc# CONTAINS "on">
,CustPWord = '#form.custpword#'
</cfif>
WHERE CustID = #form.id#
</cfquery>

Chris Scott
The Whole Computer Medical Systems
 
Are you trying to update the exact same record from both machines? I'm just wondering if maybe when you tried it from one machine you had a correct record and it so happend that from another machine it was an incorrect record.

Data type mismatch usually means you're trying to pass an invalid value to the database, for example a char value into a numeric field. Make sure the numeric fields like orderid, customerid, grandtotal, etc... are really numbers when you run the update.


Hope This Helps!

ECAR
ECAR Technologies

"My work is a game, a very serious game." - M.C. Escher
 
ECAR,
Thanks for the input. I have checked multiple times and had others check also. After further investigating, it is not client OS dependant. However, I can have two people update the same record with the same updates at different times. One will update fine and the other will error out. Again, using the same data. Weird....


Chris Scott
The Whole Computer Medical Systems
 
While there are several thing in that script I don't particularity like, I see nothing screaming "error!".

my first step would be to cfqueryparam everything in the update.

next step would be to comment out every field but the first in the update, and work your way down until you error again, check the data types. the scripts you posted have no form data validation, so it could easily be a "Data type mismatch in criteria expression"

But really, use cfqueryparam the first time around too! It is very much worth the extra code. I can't think of a reason NOT to use it every chance you can.





 
I agree. This is not my code, though. I inherited this code and am trying to get it working first and add the error check and housecleaning next. Your input is greatly appreciated though.



Chris Scott
The Whole Computer Medical Systems
 
whenI have large updates, and a problem pops up like that, it is usually something so simmple that I can't see it. That why I suggested updating only one field, then adding a field and trying again until you error. sucks, but finds the error every time!

Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top