Solved

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

Posted on 1998-10-16
6
124 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: 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!

 
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

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!

Question has a verified solution.

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

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

726 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