hughesmi
12-13-2004, 01:32 PM
Hi all. I'm getting error message can someone show me where i have gone wrong. I cant figure out what i'm doing wrong.
IIS Error Message:
Error Type:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
read.asp, line 43
Here is my code:
<html>
<head>
<title></title>
<style>
<!--
font { font-family: Arial; font-size: 10pt; font-weight: bold }
table { color: #800000 }
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<!--#INCLUDE file="dropdown.asp"-->
<hr color="#000000">
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("database.mdb")
NameID= Clng(request.QueryString("NameID"))
'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT * FROM Data WHERE NameID=" & NameID
'strSQL = "SELECT * FROM Data"
'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon
'Loop through the recordset, create a loop counter and set to zero
Dim loopCounter
loopCounter = 0
Do While not rsGuestbook.EOF
%>
<%
If loopCounter < 1 Then
%>
<center><b>ID Number <% = rsGuestbook("NameID") %>
<!--<table border="0" width="656" height="61" 0"" 486"" 106"" cellspacing="1" cellpadding="0">-->
</b>
<div style="width: 987; height: 410; overflow: auto">
<table width="617" border="0" height="73" cellspacing="1">
<tr>
<td width="18" height="25" align="center" bgcolor="#66CCFF" 160"" 35"" center"" #000000""><font size="2">Edit</font></td>
<td width="123" height="25" align="left" bgcolor="#66CCFF" 160"" 35"" center"" #000000""><font face="Arial" size="2" color #ffffff""><nobr>Name ID</font></b></font></td>
<td width="72" height="25" align="left" bgcolor="#66CCFF" 160"" 35"" #000000""><font color="" #FFFFFF""><b><font face="Arial"><nobr>Name</nobr></font></b></font></td>
</tr>
<%
End If
%>
<tr>
<td width="16" height="40" align="center" bgcolor="#66CCFF">Edit.</td>
<td width="61" height="40" align="left" bgcolor="#CCCCCC" 160"" 71"" center"" #66CCFF""><nobr><b>
<p align="center"><font size="2" face="Arial"><% = rsGuestbook("NameID") %></font></b></nobr></td>
<td width="61" height="40" align="left" bgcolor="#CCCCCC" 160"" 71"" center"" #66CCFF""><nobr><b><font size="2" face="Arial"><% = rsGuestbook("NameID") %></font></b></td>
<%
'Increment the counter
loopCounter = loopCounter + 1
'Move to the next record in the recordset
rsGuestbook.MoveNext
'rsGuestbook.Close
Loop
If loopCounter > 0 Then 'Logic is if there were records, the counter would have incremented, if greater than zero, close the table
Response.Write ("</div>")
Response.Write ("</table>")
Response.Write("</center>")
End IF
'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
</table>
</div>
</center>
<% if NameID < 1 then %>
<p><font size"2" face="Arial">Not Ready to Edit.</font>
<% else %>
<p align="center"><nobr><b><font size="2" face="Arial"><a href="quiz.asp?NameID=<% = NameID %>">More</a></font></b></nobr></p>
<% end if %>
IIS Error Message:
Error Type:
Microsoft JET Database Engine (0x80040E07)
Data type mismatch in criteria expression.
read.asp, line 43
Here is my code:
<html>
<head>
<title></title>
<style>
<!--
font { font-family: Arial; font-size: 10pt; font-weight: bold }
table { color: #800000 }
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<!--#INCLUDE file="dropdown.asp"-->
<hr color="#000000">
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsGuestbook 'Holds the recordset for the records in the database
Dim strSQL 'Holds the SQL query for the database
'Create an ADO connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
adoCon.Open = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("database.mdb")
NameID= Clng(request.QueryString("NameID"))
'Create an ADO recordset object
Set rsGuestbook = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT * FROM Data WHERE NameID=" & NameID
'strSQL = "SELECT * FROM Data"
'Open the recordset with the SQL query
rsGuestbook.Open strSQL, adoCon
'Loop through the recordset, create a loop counter and set to zero
Dim loopCounter
loopCounter = 0
Do While not rsGuestbook.EOF
%>
<%
If loopCounter < 1 Then
%>
<center><b>ID Number <% = rsGuestbook("NameID") %>
<!--<table border="0" width="656" height="61" 0"" 486"" 106"" cellspacing="1" cellpadding="0">-->
</b>
<div style="width: 987; height: 410; overflow: auto">
<table width="617" border="0" height="73" cellspacing="1">
<tr>
<td width="18" height="25" align="center" bgcolor="#66CCFF" 160"" 35"" center"" #000000""><font size="2">Edit</font></td>
<td width="123" height="25" align="left" bgcolor="#66CCFF" 160"" 35"" center"" #000000""><font face="Arial" size="2" color #ffffff""><nobr>Name ID</font></b></font></td>
<td width="72" height="25" align="left" bgcolor="#66CCFF" 160"" 35"" #000000""><font color="" #FFFFFF""><b><font face="Arial"><nobr>Name</nobr></font></b></font></td>
</tr>
<%
End If
%>
<tr>
<td width="16" height="40" align="center" bgcolor="#66CCFF">Edit.</td>
<td width="61" height="40" align="left" bgcolor="#CCCCCC" 160"" 71"" center"" #66CCFF""><nobr><b>
<p align="center"><font size="2" face="Arial"><% = rsGuestbook("NameID") %></font></b></nobr></td>
<td width="61" height="40" align="left" bgcolor="#CCCCCC" 160"" 71"" center"" #66CCFF""><nobr><b><font size="2" face="Arial"><% = rsGuestbook("NameID") %></font></b></td>
<%
'Increment the counter
loopCounter = loopCounter + 1
'Move to the next record in the recordset
rsGuestbook.MoveNext
'rsGuestbook.Close
Loop
If loopCounter > 0 Then 'Logic is if there were records, the counter would have incremented, if greater than zero, close the table
Response.Write ("</div>")
Response.Write ("</table>")
Response.Write("</center>")
End IF
'Reset server objects
rsGuestbook.Close
Set rsGuestbook = Nothing
Set adoCon = Nothing
%>
</table>
</div>
</center>
<% if NameID < 1 then %>
<p><font size"2" face="Arial">Not Ready to Edit.</font>
<% else %>
<p align="center"><nobr><b><font size="2" face="Arial"><a href="quiz.asp?NameID=<% = NameID %>">More</a></font></b></nobr></p>
<% end if %>