|
 |
asp_databases thread: data type mismatch
Message #1 by "peter" <ph@t...> on Tue, 13 Jun 2000 19:31:9
|
|
Im getting the error
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
expression.
/psychics/bww/status1.asp, line 36
The line
UPDATE customers SET sessions = '1' WHERE CustomerID = ' 54'
was the output from a response.write to check the strSQL values. The
actual
query string is :
strSessions = strSessions - 1
strSQL = "UPDATE customers SET sessions = '" & strSessions & "' WHERE
CustomerID = ' " & ID & "' "
response.write strSQL ' check strSQL
oConn.execute(strSQL) ' line 36
My latest attempt was to write
<% ID = CINT(Request.Cookies("ID"))%>
but still the same error. CustomerID is an autonumber field in Access
2000,
so logically it seems to me that there should be no data type conflict,
however, there is. Any ideas?
many thanks
peter
Message #2 by "Joycelyn Yeo" <gummy_san@h...> on Tue, 13 Jun 2000 18:13:45 PDT
|
|
Hi, your customerID field is an autonumber but
the update statement you are providing is telling Access
to update with
strSQL = "UPDATE customers SET sessions = '" & strSessions & "' WHERE
CustomerID = ' " & ID & "' "
whereby CustomerID is a string therefore result
in Data mismatch.
Use :
strSQL = "UPDATE customers SET sessions = '" & strSessions & "' WHERE
CustomerID = " & ID & " "
and your problem should be solved.
Thats it!
Message #3 by "Joe Sabado" <joe.sabado@g...> on Tue, 13 Jun 2000 13:52:26 -0700
|
|
if customerid is numeric then take the single apostrophe out
strSQL = "UPDATE customers SET sessions = '" & strSessions & "' WHERE
CustomerID = " & ID & " "
Message #4 by Tomm Matthis <matthis@b...> on Tue, 13 Jun 2000 16:55:18 -0400
|
|
You should remove the backticks from around the CustomerID data.
SQL is interpreting it as string data
Tomm
Message #5 by George Wu <GeorgeW@j...> on Tue, 13 Jun 2000 14:06:05 -0700
|
|
If customerID is a integer number, then you only need to use CustomerID
54. Single quotation is not needed. Good luck
Message #6 by "Ken Schaefer" <ken.s@a...> on Wed, 14 Jun 2000 15:31:39 +1000
|
|
Don't use ' to delimit numeric/autonumber fields:
UPDATE customers SET sessions = 1 WHERE CustomerID = 54
should work. Put the ' back around the 1 if sessions is a text/memo/varchar
field.
Cheers
Ken
----- Original Message -----
From: "peter"
To: "ASP Databases" <asp_databases@p...>
Sent: Tuesday, June 13, 2000 7:00 PM
Subject: [asp_databases] data type mismatch
> Im getting the error
>
> [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
> expression.
> /psychics/bww/status1.asp, line 36
>
> The line
>
> UPDATE customers SET sessions = '1' WHERE CustomerID = ' 54'
>
> was the output from a response.write to check the strSQL values. The
> actual
> query string is :
>
|
|
 |