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

Null recordset error

Status
Not open for further replies.

Bastien

Programmer
May 29, 2000
1,683
0
0
CA
Hi

I am getting an error when the SQL script returns a null recordset query. The SQl statement is fine and no reocords are expected for this particular client that I am querying. How can I handle the error to run some other code against it...I have

if (objTaxData(0)) <> &quot;&quot; then

call display_tax
else
Response.Write &quot;<br><br><br><center><h1><font color = red size = 7>&quot;
Response.Write &quot;There is no data for this Client.</font></center><br>&quot;
end if

yet I keep getting this error:

ADODB.Field error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record

What is the best way of handling this case?

thanks in advance

Bastien
 
Hi,

I guess objTaxData is a ADODB.Recordset. you could do something like this:

Code:
if not objTaxData.EOF And not objTaxData.BOF
'Ok, we have records
  objTaxData.movefirst
  if (objTaxData(0)) <> &quot;&quot; then
    call display_tax
  else
    Response.Write &quot;<br><br><br><center><h1>
    <font color=red size=7>&quot;
    Response.Write &quot;The data for this
    Client is empty.</font></center><br>&quot;
  end if
else
  Response.Write &quot;<br><br><br><center><h1>
  <font color=red size=7>&quot;
  Response.Write &quot;There is no data for this
  Client.</font></center><br>&quot;
end if

Hope this helps..

Jordi Reineman
 
just copy and paste this code and it will work for u if ur field have some null value


if not objTaxData.EOF And not objTaxData.BOF
'Ok, we have records
if ISNULL(objTaxData(0)) then
Response.Write &quot;<br><br><br><center><h1>
<font color=red size=7>&quot;
Response.Write &quot;The data for this
Client is empty.</font></center><br>&quot;
else
call display_tax
end if
else
Response.Write &quot;<br><br><br><center><h1>
<font color=red size=7>&quot;
Response.Write &quot;There is no data for this
Client.</font></center><br>&quot;
end if



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top