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

seemingly random database errors

Status
Not open for further replies.

Manic

Programmer
Feb 28, 2001
343
GB
Basicaly i put in a location through a link and want the output but this only works for half of my calls.

I have 10 diferent location with and without data. it works for some with and without data and not others.

The error I get is
Code:
Error Type:
(0x80020009)
Exception occurred. 
/asset/show_location.asp, line 49

Line 49 is the second call of [highlight]rsPC("Patched")[/highlight]


Code:
<%


If rsPC.BOF and rsPC.EOF Then
		Response.Write "</table>"
		Response.Write "<h2 align='center'>No equipment found for "& R &" </h2>"
Else

rsPC.MoveFirst
Do Until rsPC.EOF
		Response.Write "<tr><td colspan='5' height='1' class='Nav_Admin_Line'></td></tr>"
		Response.Write "<tr><td valign='top'>" & rsPC("Patched") & "</td>"
		Response.Write "<td valign='top'>" & rsPC("PC_Name") & "</td>"
		Response.Write "<td><a href='show_user.asp?ID="& rsPC("ID") & "'>" & rsPC("User") & "</a></td>"
		Response.Write "<td valign='top'>" & rsPC("Dept") & "</td>" 
		Response.Write "<td valign='top'>" & rsPC("IP") & "</td></tr>"
   rsPC.MoveNext
   		Response.Write "<tr><td colspan='5' height='1' class='Nav_Admin_Line'></td></tr>"
		[highlight]Response.Write "<tr class='show_odd'><td valign='top'>" & rsPC("Patched") & "</td>"[/highlight]
		Response.Write "<td valign='top'>" & rsPC("PC_Name") & "</td>"
		Response.Write "<td><a href='show_user.asp?ID="& rsPC("ID") & "'>" & rsPC("User") & "</a></td>"
		Response.Write "<td valign='top'>" & rsPC("Dept") & "</td>" 
		Response.Write "<td valign='top'>" & rsPC("IP") & "</td></tr>"
   rsPC.MoveNext
Loop 

End If 
%>

Manic
-----------------------------
I've broken it again !!
-----------------------------
 
you have 2 rsPC.MoveNext ops in one loop.

this will cause the last iteration to go beyond the end of the recordset.

Chris.

Indifference will be the downfall of mankind, but who cares?
A website that proves the cobblers kids adage.
Nightclub counting systems

So long, and thanks for all the fish.
 
Thanks didn't think about that.

now need to work on if statement.

Manic
-----------------------------
I've broken it again !!
-----------------------------
 
just use "if not rspc.eof then " afteryour move next statement, you will probably need to add an Else to it to response out an empty set of <TD>'s so that you dont ruin the page format when you hit the end of the recordset

you will only need this on the bottom half and make sure the second rspc.movenext is inside the first portion of the if statement, otherwise you'll get an error on the movenext line



[thumbsup2]DreX
aKa - Robert
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top