?
Solved

SQL Connection query question

Posted on 2004-11-03
4
Medium Priority
?
151 Views
Last Modified: 2010-05-02
I have a SQL Query that is called from a VBScript, something like the following:

Query = "select UserCount from .....
Set Result = objConn.Execute(Query)

It works just fine.  I recently ran into a problem where the query returns no results.  If I do this in ISql I get the same response - no records match the query, so the results window is empty.

How would I go about validating the results?  If I have something like:
wscript.echo Result("UserCount") after a query that returns no results I get an error.

Thanks!
0
Comment
Question by:robrandon
  • 2
4 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12483068
dim count

on error resume next   ' this line is import

count = Result.recordcount
if (count = 0 ) then
' no record
end if
0
 
LVL 48

Accepted Solution

by:
Mikal613 earned 500 total points
ID: 12483086
If Not Result .EOf then
else
end if

Check the EOF
0
 
LVL 16

Author Comment

by:robrandon
ID: 12483170
Mikal613's is a lot smoother.  Thanks!
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 12483196
thanks
0

Featured Post

Industry Leaders: 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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month16 days, 6 hours left to enroll

850 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