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

request.querystring produced Data type mismatch

Status
Not open for further replies.

gavray

Programmer
Jul 17, 2000
65
GB
Hi, can anyone help?

I've coded a link with an ID string. but I get the following error

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

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

This is the code

<%
strID = request.querystring(&quot;ID&quot;)
Dim oRS2
dim iRowCounter
Set oRS2=Server.CreateObject(&quot;adodb.Recordset&quot;)

sSQL=&quot;SELECT JobTable.Company&quot;
sSQL=sSQL & &quot; FROM JobTable&quot;
sSQL=sSQL & &quot; WHERE ID= &quot; & &quot;'&quot; & ID & &quot;'&quot;
sSQL=sSQL & &quot; ORDER BY Jobtable.Company;&quot;

oRS2.open sSQL, &quot;DSN=50on&quot;
response.write&quot;<table><tr>&quot;
response.write &quot;<td>&quot; & oRS2 (&quot;Company&quot;) & &quot;</td></tr>&quot;

oRS2.Close
set oRS2=Nothing
response.write &quot;</table>&quot;
%>
 
your sql is wrong on two accounts

sSQL=&quot;SELECT JobTable.Company&quot;
sSQL=sSQL & &quot; FROM JobTable&quot;
sSQL=sSQL & &quot; WHERE ID= &quot; & &quot;'&quot; & ID & &quot;'&quot;
sSQL=sSQL & &quot; ORDER BY Jobtable.Company;&quot;

Isnt it strID the variable that you r storing the ID from the querystring and

sSQL=sSQL & &quot; where id = '&quot; & strID & &quot;'&quot;
sSQL=sSQL & &quot; ORDER BY Jobtable.Company;&quot;

I think that, that is the problem but what i cannot understand is that how dows it give you a datatype mismatch

regards ::) Unicorn11
abhishek@tripmedia.com

[red]Nothing is permanent in life except Change[red]
 
Is ID a numeric or character field? If it is a numeric field, do not wrap it in single quotes.

Choo Khor
choo.khor@intelebill.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top