Solved

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

Posted on 1998-10-16
6
121 Views
Last Modified: 2013-12-25
When I run a query that doesn't find any matches it
causes an error on the web page.  Has anyone encountered
this?  
0
Comment
Question by:denam
  • 3
  • 2
6 Comments
 
LVL 1

Author Comment

by:denam
ID: 1855773
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
 
LVL 10

Expert Comment

by:MasseyM
ID: 1855774
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
 
LVL 28

Expert Comment

by:sybe
ID: 1855775
<%
If Not RSGL.EOF Then
  ..do you things
End If
%>
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 1

Author Comment

by:denam
ID: 1855776
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
 
LVL 28

Accepted Solution

by:
sybe earned 50 total points
ID: 1855777
Try this:

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


0
 
LVL 1

Author Comment

by:denam
ID: 1855778
isn't this just a hack?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to count occurrences of each item in an array.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now