473,408 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Can multi queries be done in ASP pages?

The following statement works fine in SQL Query Analyser: SELECT count(*) as
a from NEWUSERS WHERE activated='Y'; SELECT count(*) as b from NEWUSERS
WHERE activated='N' -- It returns two values, yet when I have it in a .asp
file, it only displays the first value. Is there anyway around this, without
making two connections to the DB, and running two seperate queries?

--

Kind Regards
Rudi Ahlers
+27 (82) 926 1689

Greater love has no one than this, that he lay down his life for his friends
(John 15:13).
Jul 19 '05 #1
3 1305
Sure. Assuming your recordset variable is "rs" then try this:

dim firstvalue, secondvalue
firstvalue = rs("a")
set rs = rs.nextRecordset
secondvalue = rs("b")
rs.close
set rs = nothing

- Wm

--
William Morris
Product Development, Seritas LLC
Kansas City, Missouri

"Lord Merlin" <SP4M_Rudi@SP4M_Bonzai.org.za_SP4M> wrote in message
news:XJ********************@is.co.za...
The following statement works fine in SQL Query Analyser: SELECT count(*) as a from NEWUSERS WHERE activated='Y'; SELECT count(*) as b from NEWUSERS
WHERE activated='N' -- It returns two values, yet when I have it in a .asp
file, it only displays the first value. Is there anyway around this, without making two connections to the DB, and running two seperate queries?

--

Kind Regards
Rudi Ahlers
+27 (82) 926 1689

Greater love has no one than this, that he lay down his life for his friends (John 15:13).

Jul 19 '05 #2
Lord Merlin wrote:
The following statement works fine in SQL Query Analyser: SELECT
count(*) as a from NEWUSERS WHERE activated='Y'; SELECT count(*) as b
from NEWUSERS WHERE activated='N' -- It returns two values, yet when
I have it in a .asp file, it only displays the first value. Is there
anyway around this, without making two connections to the DB, and
running two seperate queries?


Why not combine them into a single query?

SELECT activated,Count(*) from NEWUSERS
GROUP BY activated

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #3
Not that this is a deterrent from your method, but I would bet that
activated allows NULLs, so you might want to add WHERE activated IN ('Y',
'N') or WHERE activated IS NOT NULL or something along those lines. Or,
don't allow NULLs in the column in the first place. ;-)

(Otherwise, you will get three rows in your resultset.)

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:u7**************@TK2MSFTNGP10.phx.gbl...
Lord Merlin wrote:
The following statement works fine in SQL Query Analyser: SELECT
count(*) as a from NEWUSERS WHERE activated='Y'; SELECT count(*) as b
from NEWUSERS WHERE activated='N' -- It returns two values, yet when
I have it in a .asp file, it only displays the first value. Is there
anyway around this, without making two connections to the DB, and
running two seperate queries?


Why not combine them into a single query?

SELECT activated,Count(*) from NEWUSERS
GROUP BY activated

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Laphan | last post by:
Hi All Just wanted to know if anybody knows the answer to the following quick queries: 1) The reason I'm using VB's INET control is to download copies of Ms Access DBs on a range of web sites...
0
by: Leif | last post by:
I've seen some pages with the footer: This page was created in 0.003s using 123 queries. Is there a way to get the number of queries on a single connection? I could fetch the value of "SHOW...
6
by: Andrew V. Romero | last post by:
First off, I am mostly familier with PHP but am trying to make a multi-step javascript program. For an example, I would like to run different sections of the script depending on how many times the...
10
by: *ProteanThread* | last post by:
since a majority of people are still on dial up or at most DSL (though there *IS* broadband) does it help or hurt one's webpage adding multi media ? does it necessarily distract from the theme of...
6
by: Brad | last post by:
I have an sql query that has specific criteria (like state='PA' or state = 'NJ'...) and would like to be able to have the user specify the criteria dynamically either through the web or from...
0
by: deathyam | last post by:
Hi, I am writing an application in Excel 97 in which the users click a button and data is saved/read to and from an Access 97 database on the LAN. I am concerned about performance because there...
0
by: JeffJones176 | last post by:
Hello All: I am very new to multi-threaded programming and have a need (I think) to write an application that uses multi-threaded pages. My scenario follows: My business has multiple...
1
by: mskapek | last post by:
I need some advise on how to best create an Access 2002 report from multiple "total" queries, each which result in 3- 5 values that I need displayed on my report. Most of the queries do simple...
6
by: dbuchanan | last post by:
There are three parts to this 1.) How do I cascade menus? 2.) And, how do I cascade menus with a multi-select CheckBoxList?
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.