SQL statement in ASP

liunx

Guest
Ok, heres what i'm dealing with...

i want to get a ton of columns from my database where the idnumber = some number
here is the code:
<%@ Language=VBScript %>
<%Response.Buffer = True %>
<%

idnum = request.Cookies("idnum")

Set dbaseConn = Server.CreateObject("ADODB.Connection")
dbaseConn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("\db\requestforms.mdb") & ";"

SQLQuery = "SELECT email, sitepurpose, sitename, navneeds, look, searchx, audiox, videox, contactx, widgetsx, photosx, morex, specify, publishneeds from forms where formID = '" & idnum & "'"

Set RSverify = dbaseConn.Execute(SQLQuery)

%>

after i run it i get this error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

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

line 14 btw, line 14 is where it says Set RSverify = dbaseConn.Execute(SQLQuery)

i have no idea what the problem is

PLEASE <!-- m --><a class="postlink" href="HELPhttp://tutorials.aspfaq.com/8000xxxxx-errors/why-do-i-get-80040e57/80040e07-errors.html">HELPhttp://tutorials.aspfaq.com/8000xxx ... rrors.html</a><!-- m -->

Scroll down about half way to your exact error...

In case you d not want to click the link, here is what it says:


Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]
The conversion of a CHAR data type to a DATETIME data type resulted in an
out-of-range DATETIME value.

or

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC SQL Server Driver][SQL Server]
The conversion of CHAR to DATETIME resulted in a DATETIME value out of range.

or

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.

or

Microsoft JET Database Engine error '80040e07'
Data type mismatch in criteria expression.

This error usually happens when you do one of the following things:
* attempt to insert a date in Access with ' delimiters;
* attempt to insert a date in SQL Server with # delimiters;
* attempt to insert a date in Access or SQL Server with no delimiters; or,
* attempt to insert a malformed date.Debug it.

Example, find out a few things:
- idnum contains any value or not?
- response.write SQLQuery to see if anything gone wrong.
- Copy the query and see if you can run in the db.It's because you are saying: formID = '" & idnum & "'"

I'll be you anything if you rather say: formID = " & idnum it will work as formID is most probably a number field.
 
Back
Top