Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 130
  • Last Modified:

SQL Query returns error if no matches found (using ASP, MSSQL)

When I run a query that doesn't find any matches it
causes an error on the web page.  Has anyone encountered
this?  
0
denam
Asked:
denam
  • 3
  • 2
1 Solution
 
denamAuthor Commented:
This is the query:

sGL = "Select LNK.link_id, LNK.link_name from Links LNK, link_sub_index IDX where "
sGL = sGL & " sub_id = " & strID & " and LNK.link_id = IDX.link_id"
Set RSGL = TIADB.Execute(sGL)

This is the error:
ADODB.Field error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted; the operation
requested by the application requires a current record.
/private/management/link/remlink.asp, line 49
0
 
MasseyMCommented:
YOu can add this to the top of your ASP page..

<% On Error Resume Next %>

but that is not good to use for begugging :)
0
 
sybeCommented:
<%
If Not RSGL.EOF Then
  ..do you things
End If
%>
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
denamAuthor Commented:
Sybe, this is pretty much what I have already.  I worded it a little differently:

<%
    while RSQuery.eof = False
         ..do things
    RSQuery.movenext
    wend
%>

Are you supposed to get an error when a query finds no matches?  I assume it's either
that or a problem in the script.
0
 
sybeCommented:
Try this:

<%
Do While Not RSQuery.EOF
  ..do things
  RSQuery.movenext
Loop
%>


0
 
denamAuthor Commented:
isn't this just a hack?
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now