473,585 Members | 2,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1310
Sure. Assuming your recordset variable is "rs" then try this:

dim firstvalue, secondvalue
firstvalue = rs("a")
set rs = rs.nextRecordse t
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******@NOyah oo.SPAMcom> wrote in message
news:u7******** ******@TK2MSFTN GP10.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
6049
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 so that I have a backup. Found out from my ISP that if my DBs go up the spout then it's down to me to restore - gulp!!! I've created a little...
0
1327
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 STATUS LIKE Questions" at the start and end of the page, but that would also count queries from other pages running at the same time, on a busy server....
6
3772
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 user presses the submit button: <form method="post" name="step1" action="test.html"> <script language="JavaScript"> var position
10
2030
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 the webpage ? Are we ready to move from static webpages to webpages that are more fluid ? Is it cost that is prohibiting this move ? Cost of what...
6
2111
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 MSAccess or another tool. The query also does a GROUP BY the state and other variables that are part of the criteria. I know how to get MSAccess and...
0
1405
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 will be multiple users using it at the same time. Generally my technique for database reads is as follows: -I create parameter queries in the...
0
1161
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 databases, multiple websites, like a franchised business, and multiple branches that go to each website (22 branches for one website, 2 for another, etc.).
1
2035
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 counts based on 3 different tables. For instance, I need to count the number of new clients enrolled in a program for a given month or year-to-date...
6
3492
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
7904
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8334
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
8209
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5707
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5386
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3856
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2340
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1444
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1171
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.