By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,058 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,058 IT Pros & Developers. It's quick & easy.

Error: Microsoft JET Database Engine (0x80040E07)

P: n/a
I don't understand when I do (2), it will throw the error when I run the
ASP. (1) is working fine. Should I use a single quote between the string in
SQL statement in ASP?

(1) strSQL = "SELECT * FROM DATA WHERE id = " & strParm1
(2) strSQL = "SELECT * FROM DATA WHERE id = " & "'" & strParm1 & "'"

Error Type:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
Please help. Thanks!
John


Jul 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
What's the type of the underlying column? Integer types don't need
delimiters:

strSQL = "SELECT * FROM DATA WHERE id = " & strParm1

Text types need single quotes:

' Note -- Different syntax than yours below.
strSQL = "SELECT * FROM DATA WHERE id = '" & strParm1 & "'"

Date types need a hash for Jet, singles quotes in SQL Server:

' Jet
strSQL = "SELECT * FROM DATA WHERE id = #" & strParm1 & "#"

' SQL Server
strSQL = "SELECT * FROM DATA WHERE id = '" & strParm1 & "'"

Cheers,

Alan

"John Davis" <jr*******@hotmail.com> wrote in message
news:ur**************@TK2MSFTNGP10.phx.gbl...
I don't understand when I do (2), it will throw the error when I run the
ASP. (1) is working fine. Should I use a single quote between the string in SQL statement in ASP?

(1) strSQL = "SELECT * FROM DATA WHERE id = " & strParm1
(2) strSQL = "SELECT * FROM DATA WHERE id = " & "'" & strParm1 & "'"

Error Type:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
Please help. Thanks!
John

Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.