Print Page | Close Window

Data type mismatch

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=2981
Printed Date: 29 March 2026 at 2:58pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Data type mismatch
Posted By: Mart
Subject: Data type mismatch
Date Posted: 23 May 2003 at 2:52pm

Could anyone tell me why im getting this error? (line 178 is highlighted)

Error:

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

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

/************/db/default.asp, line 178

Code:

<%

Dim con
Dim rs
Dim strSQL


Set con = Server.CreateObject("ADODB.Connection")


con.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("********.mdb")

Set rs = Server.CreateObject("ADODB.Recordset")


strSQL = "SELECT tblLogin.* From tblLogin WHERE tblLogin.ID = '" & request.cookies("login") & "';"

rs.Open strSQL, con


Do While Not rs.EOF

response.write "<img src=""rating/" & rs("Rating") & ".gif"">"

Select case rs("Rating")

case 1
response.write(" Private")

Case 2
response.write(" Sergant")

Case 3
response.write(" Commander")

Case 4
Response.write(" Major")

Case 5
Response.write(" General")

End Select

     rs.MoveNext

Loop


rs.Close
Set rs = Nothing
Set con = Nothing

%>

Thanks in advance, Martin.




Replies:
Posted By: aero
Date Posted: 23 May 2003 at 4:55pm

try this

 

<%

Dim con
Dim rs
Dim strSQL

Set con = Server.CreateObject("ADODB.Connection")
DSN = "DRIVER={Microsoft Access Driver (*.mdb)}; " 
DSN = DSN & "DBQ=" & Server.MapPath("********.mdb")
con.Open DSN

strSQL = "SELECT tblLogin.* From tblLogin WHERE tblLogin.ID = '" & request.cookies("login") & "';"

set rs = con.Execute(SQL)

Do While Not rs.EOF

response.write "<img src=""rating/" & rs("Rating") & ".gif"">"

Select case rs("Rating")

case 1
response.write(" Private")

Case 2
response.write(" Sergant")

Case 3
response.write(" Commander")

Case 4
Response.write(" Major")

Case 5
Response.write(" General")

End Select

     rs.MoveNext

Loop


rs.Close
Set rs = Nothing
con.Close
Set con = Nothing

%>

 

it may work !!!!!



Posted By: aero
Date Posted: 23 May 2003 at 4:57pm
OR maybe just delete ", con" in the line rs.Open strSQL, con



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net