|
 |
access_asp thread: Data type mismatch
Message #1 by bayou_ranch@m... on Wed, 10 Jul 2002 14:37:37
|
|
In trying to execute a query I get the following message:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
expression.
In an attempt to debug I had the page display the value of my variable,
the value is : 59
I am attempting to call up a record by it's Primary Key which is "Auto
Number" and is incrementing long interger. I am baffled as to why I get
the error. Here is the query:
Sub EditDrug( intid )
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM z_drug_prices WHERE RecordNumber
= '" & intid & "'", "DSN=data0;"
'do someting here
End Sub
In my frustration I have tried changing the query by using the following:
Sub EditDrug( intid )
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM z_drug_prices WHERE RecordNumber
= '" & CLng(intid) & "'", "DSN=data0;"
'do someting here
End Sub
I have also tried CInt(intid) and I have tried using the CInt and CLng
functions prior to the sql statement like this:
Sub EditDrug( intid )
intid = CLng(intid)
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "SELECT * FROM z_drug_prices WHERE RecordNumber
= '" & intid & "'", "DSN=data0;"
'do someting here
End Sub
In all cases, I get the same mismatch error. Does anyone know why?
I have missed some critical information in my novice learning
experience...lol
Thanks in advance
William
Message #2 by "Ken Schaefer" <ken@a...> on Thu, 11 Jul 2002 11:20:41 +1000
|
|
www.adopenstatic.com/faq/80040e07.asp
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: <bayou_ranch@m...>
Subject: [access_asp] Data type mismatch
: In trying to execute a query I get the following message:
:
: Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
:
: [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria
: expression.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "asif hameed" <asifqua@h...> on Fri, 12 Jul 2002 11:15:01 +0000
|
|
<html><div style='background-color:'><DIV>i m still facing problems due a
query</DIV>
<DIV>i want to get data between two dates.my field type in table is date. </DIV>
<DIV> </DIV>
<DIV>com.CommandText="select * from candidate where idate >='#"&sdate &"#' and idate
<='#"& edate &"#';"</DIV>
<DIV>but this query is not running and giving the error</DIV>
<DIV> </DIV>
<DIV>Error Type:<BR>Microsoft JET Database Engine (0x80040E07)<BR>Data type mismatch in criteria
expression.<BR><B>/project/inqviewdata.asp, line 23</B><BR></DIV>
<DIV>how i can solve this problem</DIV>
<DIV>plz help me</DIV>
<DIV>thanks</DIV>
<DIV> </DIV>
<DIV>Asif Hameed</DIV>
<DIV> </DIV></div><br clear=all><hr>MSN Photos is the easiest way to share and print your
photos: <a href='http://g.msn.com/1HM1ENXX/c156??PI=31901'>Click Here</a><br></html>
Message #4 by "Larry Woods" <larry@l...> on Fri, 12 Jul 2002 07:17:43 -0700
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0181_01C22974.37086F40
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
Asif,
Get rid of the single quotation marks in the WHERE. Also, as an alternative
to the way you have defined the selection, you can use BETWEEN.
com.CommandText="SELECT * FROM candidate WHERE idate BETWEEN #" & sdate & "#
AND #" & edate & "#;"
Notice, no single quotes.
Hope this helps...
Larry Woods; MCSD,MCT
-----Original Message-----
From: asif hameed [mailto:asifqua@h...]
Sent: Friday, July 12, 2002 4:15 AM
To: Access ASP
Subject: [access_asp] data type mismatch
i m still facing problems due a query
i want to get data between two dates.my field type in table is date.
com.CommandText="select * from candidate where idate >='#"&sdate &"#' and
idate <='#"& edate &"#';"
but this query is not running and giving the error
Error Type:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
/project/inqviewdata.asp, line 23
how i can solve this problem
plz help me
thanks
Asif Hameed
----------------------------------------------------------------------------
--
MSN Photos is the easiest way to share and print your photos: Click Here
--- Change your mail options at http://p2p.wrox.com/manager.asp or to
unsubscribe send a blank email to
|
|
 |