Hello, I am experiencing a problem when using an if statement. What I am trying to do is retrieve information from my database. It' works when there are records in the database that match the conditions of the SQL query. However if there are no results found I get a IIS generated error page, when what I really want is my own specified error page to be displayed. The code I am using is as follows:
If Not (objRS.eof And objRS.bof) Then
Response.Write ("<table Align=""center"" border=""0"">"
Response.Write ("<tr>"
Response.Write ("<td width=""200"">" & objRS("EquipDescript" & "</td>"
Response.Write ("<td width=""150"">" & objRS("ContractNo" & "</td>"
Response.Write ("<td width=""300"">" & objRS("Location" & "</td>"
Response.Write ("<td width=""100""><a href=""EquipmentCfg.asp"">View Config</a></td>"
Response.Write ("</tr>"
Response.Write ("</table>"
objRS.MoveNext
Else
Response.Redirect ("PartsError.asp"
End if
The error I get is :
Error Type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
Can you please help me to find where I am going wrong. Thank you.
If Not (objRS.eof And objRS.bof) Then
Response.Write ("<table Align=""center"" border=""0"">"
Response.Write ("<tr>"
Response.Write ("<td width=""200"">" & objRS("EquipDescript" & "</td>"
Response.Write ("<td width=""150"">" & objRS("ContractNo" & "</td>"
Response.Write ("<td width=""300"">" & objRS("Location" & "</td>"
Response.Write ("<td width=""100""><a href=""EquipmentCfg.asp"">View Config</a></td>"
Response.Write ("</tr>"
Response.Write ("</table>"
objRS.MoveNext
Else
Response.Redirect ("PartsError.asp"
End if
The error I get is :
Error Type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
Can you please help me to find where I am going wrong. Thank you.