Error: ADODB.Recordset (0x800A0BB9)
Hi,
I am receiving this error and havn't a clue why:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
PostMessage.asp, line 285
Here's my code, which the error is pointing to:
Response.Write "<br><br><TABLE width = 90% BORDER=0>"
i=0
do while i<10
Response.Write "<TR><h2>" & rs("Subject") & "</h2></TR>"
Response.Write "<TR>" & rs("Message") & "</TR><br>"
Response.Write "<TR><td>" & rs("Name") & "</td>"
Response.Write "<td>" & rs("TownCity") & "</td>"
Response.Write "<td>" & rs("Date") & "</td></tr><br><br>"
'Response.Write "<tr><img src="images/line.jpg" width="500" height="10"></tr>"
rs.MoveNext
i=i+1
loop
Response.Write "</TABLE>"
Thanks
Re: Error: ADODB.Recordset (0x800A0BB9)
What is your SQL statement? The error is in there ..
Also, if you uncomment this ..
'Response.Write "<tr><img src="images/line.jpg" width="500" height="10"></tr>"
it should be this ..
Response.Write "<tr><img src=""images/line.jpg"" width=""500"" height=""10""></tr>"
but its also missing the cell tags <td> and </td> ..
Re: Error: ADODB.Recordset (0x800A0BB9)
Hi Rory, thanks for your help again!
Here's where the problem is now:
Dim rs, conn
set conn = Server.CreateObject("ADODB.connection")
set rs = Server.CreateObject("ADODB.Recordset")
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open(MM_shop_STRING)
sqlstr = "select * from MessageBoard order by Subject"
rs.Open sqlstr, conn,3,3
rs.MoveFirst
Response.Write "<br><br><TABLE width = 90% BORDER=0>"
i=0
do while i<5
Response.Write "<TR><h2>" & rs("Subject") & "</h2></TR>" <--- This is the line which the error is on!
Response.Write "<TR>" & rs("Name") & "</TR><br>"
Response.Write "<TR>" & rs("TownCity") & "</TR><br>"
Response.Write "<TR>" & rs("Message") & "</TR><br>"
Response.Write "<TR>" & rs("Date") & "</TR><br><br><br>"
rs.MoveNext
i=i+1
loop
Response.Write "</TABLE>"
rs.Close
set rs = Nothing
Re: Error: ADODB.Recordset (0x800A0BB9)
This is more like what it should look like ..
as long as those Rs fields exist in the database ..
Make sure your Connection String is right also ..
Code:
<%
Dim rs, conn, i
set conn = Server.CreateObject("ADODB.connection")
conn.Open(MM_shop_STRING)
set rs = conn.execute("select * from MessageBoard order by Subject")
If Not rs.Eof Then
Response.Write "<br><br><TABLE width=""90%"" BORDER=""0"">" & vbCrLf
i = 0
do while i<5
Response.Write "<TR><td><h2>" & rs("Subject") & "</h2></td></TR>" & vbCrLf
Response.Write "<TR><td>" & rs("Name") & "</td></TR>" & vbCrLf
Response.Write "<TR><td>" & rs("TownCity") & "</td></TR>" & vbCrLf
Response.Write "<TR><td>" & rs("Message") & "</td></TR>" & vbCrLf
Response.Write "<TR><td>" & rs("Date") & "</td></TR><br><br>" & vbCrLf
rs.MoveNext
i=i+1
loop
Response.Write "</TABLE>" & vbCrLf
Else
Response.Write "No Records" & vbCrLf
End If
rs.Close
set rs = Nothing
conn.close
set conn = nothing
%>
Re: Error: ADODB.Recordset (0x800A0BB9)
Thanks for that, but all it displays now is the No Records message?
Re: Error: ADODB.Recordset (0x800A0BB9)
Id go even further and make it look like this ..
Code:
<%
Option Explicit
Dim objConn
Dim objRs
Dim iCount
Dim sText
On Error Resume Next
Set objConn = Server.CreateObject("ADODB.connection")
objConn.Open(MM_shop_STRING)
Set objRs = objConn.Execute("select * from MessageBoard order by Subject")
If Not objRs.Eof Then
Dim rsSubject
Dim rsName
Dim rsTownCity
Dim rsMessage
Dim rsDate
sText = "<br><br><table width=""90%"" Border=""0"">" & vbCrLf
iCount = 0
Do While iCount < 5
rsSubject = isNul(objRs("Subject"))
rsName = isNul(objRs("Name"))
rsTownCity = isNul(objRs("TownCity"))
rsMessage = isNul(objRs("Message"))
rsDate = isNul(objRs("Date"))
sText = sText & "<tr><td><h2>" & rsSubject & "</h2></td></tr>" & vbCrLf
sText = sText & "<tr><td>" & rsName & "</td></tr>" & vbCrLf
sText = sText & "<tr><td>" & rsTownCity & "</td></tr>" & vbCrLf
sText = sText & "<tr><td>" & rsMessage & "</td></tr>" & vbCrLf
sText = sText & "<tr><td>" & rsDate & "</td></tr><br><br>" & vbCrLf
objRs.MoveNext
iCount = iCount + 1
Loop
sText = sText & "</table>" & vbCrLf
Else
sText = "No Records" & vbCrLf
End If
Function isNul(value)
If ISNull(value) or value = "" Then
isNul = ""
Else
isNul = value
End If
End Function
objRs.Close
Set objRs = Nothing
objConn.close
Set objConn = Nothing
If Err = 0 Then
Response.Write sText
Else
Response.Write "Error " & Err.Number & "<br>" & Err.Description
End If
%>
Re: Error: ADODB.Recordset (0x800A0BB9)
Quote:
Originally Posted by mick1982
Thanks for that, but all it displays now is the No Records message?
Are you sure the connection string is correct ..?
also check the SQL statement .. make sure those fields exist ..
Check the ordering also .. run the SQL query in the database first
if you want to troubleshoot ..
Re: Error: ADODB.Recordset (0x800A0BB9)
Rory, I have it working now, I made a change to the SQL statement and for some reason it worked. But I need to know how to get a memo file to display on multiple lines, because as it stands this field is deforming my template!
Re: Error: ADODB.Recordset (0x800A0BB9)
First .. with Memo fields you should always assign them to a temporary var first .. then do some work on them ..
tMemo = rs("myMemo")
If Not IsNull(tMemo) or tMemo <> "" Then
sMemo = tMemo
End If
as for the other thing .. cant say without more code or info, but 7am .. time for sleep .. ;-)
Re: Error: ADODB.Recordset (0x800A0BB9)