Solved

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

Posted on 1998-10-16
6
122 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
app server have enough resources... 2 41
Remove lines by logo 2 30
Where can I find... 1 34
URGENT - Wordpress site missing  theme 9 41
Read about why website design really matters in today's demanding market.
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

809 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