473,320 Members | 1,965 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,320 software developers and data experts.

How can start a new query if I'm already in a 'while(drSQL.Read){}??

while (drSQL.Read())
{
In here I need to start a new query on a different table.
}
How can I do that?
Thanks,
Trint

Nov 16 '05 #1
2 945
trint,

You would have to open another connection to the database in order to do
this, as you couldn't do it on the one the data reader is currently acting
on.

Either that, or you could read the results into a dataset, and then
cycle through the rows.

However, the most efficient thing to do might be to flatten out the
table structure. I assume you would make a query based on the contents of
the current row. This assumes that there is a relation of some kind. It's
better to do it in the query itself, and let the DBMS handle that kind of
operation, and then just cycle through the results, noting when the
conditions on the outer groupings change.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"trint" <tr***********@gmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
while (drSQL.Read())
{
In here I need to start a new query on a different table.
}
How can I do that?
Thanks,
Trint

Nov 16 '05 #2
best way: don't use datareader.

Get the data back in a dataset. Then, when you are going through the
resultset, you aren't constrained about what further information you need.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"trint" <tr***********@gmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
while (drSQL.Read())
{
In here I need to start a new query on a different table.
}
How can I do that?
Thanks,
Trint

Nov 16 '05 #3

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

Similar topics

5
by: Rob Wahmann | last post by:
I have a web-based admin section for a site and I would like to be able to query the SQL Server database size and display it within my admin area. Is there a function or method of doing this? My...
3
by: Trint Smith | last post by:
I have a While drSQL.Read() do something End While I need the While so I can't use the else and don't know what the alternate condition of the drSQL.Read() could be. BUT, if the While loop...
2
by: Saran | last post by:
Hi, Below is my scenario... I want to restrict my clients to access one of my class property in ReadOnly mode. At the same time as an author of the component i would like to have read-write...
0
by: darkking | last post by:
Ok, I'm trying to read data from the serial port. Problem is, that i always have to query the port for new data, and in 99.9% of acses my query doesn't return the result cause of the fact it's...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.