473,386 Members | 2,050 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,386 software developers and data experts.

reuse SQLDataReader in multiple dropdownlists?

I would like to reuse a SQLDataReader that is populated with information as
the datasource for multiple dropdownlists. Unfortunately, the first DDL
closes the SDR and my code fails on the second DDR. Is there a way to
copy/clone the SDR? Is there another solution?

Thanks,

Craig Buchanan
Nov 18 '05 #1
4 3611
DataSet. Can bind to as many controls as you wish.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
I would like to reuse a SQLDataReader that is populated with information as the datasource for multiple dropdownlists. Unfortunately, the first DDL
closes the SDR and my code fails on the second DDR. Is there a way to
copy/clone the SDR? Is there another solution?

Thanks,

Craig Buchanan

Nov 18 '05 #2
Not to mention it's disconnected. DataReaders keep an open connection to the
database so re-using the same DataReader will waste a lot of bandwidth and
server time fetching the rows again and again. The DataSet (or DataTables
for that matter) fetch all the results and then close the connection. Much
more efficient if you are using the data repeatedly and much nicer on the
database.

Hope this helps
Mark Fitzpatrick
Microsoft MVP - FrontPage

"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamM> wrote in
message news:O7**************@TK2MSFTNGP11.phx.gbl...
DataSet. Can bind to as many controls as you wish.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************** ********************
Think Outside the Box!
************************************************** ********************
"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
I would like to reuse a SQLDataReader that is populated with information

as
the datasource for multiple dropdownlists. Unfortunately, the first DDL
closes the SDR and my code fails on the second DDR. Is there a way to
copy/clone the SDR? Is there another solution?

Thanks,

Craig Buchanan


Nov 18 '05 #3
Another solution is that you can bind your second DDL to your first.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
I would like to reuse a SQLDataReader that is populated with information as the datasource for multiple dropdownlists. Unfortunately, the first DDL
closes the SDR and my code fails on the second DDR. Is there a way to
copy/clone the SDR? Is there another solution?

Thanks,

Craig Buchanan

Nov 18 '05 #4
how is this done? the datasource is write only.

thanks,

craig

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:uA**************@TK2MSFTNGP10.phx.gbl...
Another solution is that you can bind your second DDL to your first.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Craig Buchanan" <so*****@somewhere.com> wrote in message
news:eK**************@TK2MSFTNGP09.phx.gbl...
I would like to reuse a SQLDataReader that is populated with information

as
the datasource for multiple dropdownlists. Unfortunately, the first DDL
closes the SDR and my code fails on the second DDR. Is there a way to
copy/clone the SDR? Is there another solution?

Thanks,

Craig Buchanan


Nov 18 '05 #5

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

Similar topics

4
by: lakshmi | last post by:
Hi all, My requirement is I need to have three different recordsets open at the same time. Traversing through the 3 recordsets, I would check on the data and based on some rules, return an object...
1
by: Arvind P Rangan | last post by:
Hi All, How do you get all the values of a sqldatareader if it contains multiple resultset. Using sqldatareader.nextresult and sqldatareader.read e.g. While sqldatareader.read ' If not...
2
by: Harry | last post by:
Hi, Quick question regarding dropdownlists. On one page I have 10 asp:dropdownlists. The user selects an option from a dropdown list and then it updates an asp:label with the relevant text....
11
by: Ranginald | last post by:
This question is about how to handle an .aspx page that references multiple methods and where to store these methods (e.g. one codefile or multiple codefiles). PREFACE ======== I have a simple...
19
by: jacob navia | last post by:
There is an interesting discussion running in Slashdot now, about code reuse. The thema of the discussion is here: < quote > Susan Elliot Sim asks: "In the science fiction novel, 'A Deepness...
3
by: RSH | last post by:
Hi, I am having this very bizarre occurance with 4 dropdown lists on my ASP .Net page. Each control has its own unique id. When the user selects a value from each of the dropdownlists it is...
1
by: klaul | last post by:
I've been trying to do this for a day and a half now, and am clearly getting nowhere! The database I'm using is used to keep a log of service calls to various companies. When the user inserts data,...
4
by: Cirene | last post by:
I have a sqldatareader that I use to read some data. Later I do a dr.close. In the same sub I later to "dr = MyCommand.ExecuteReader" because I'm trying to reuse the var with a totally different...
20
luckysanj
by: luckysanj | last post by:
Hello Sir, I have an one problme when inserting data. I want to insert data through function cuz of reuse function. function add_rec($tbl,$flds,$val) { $sql="insert into $tbl ($flds)...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
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,...
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,...

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.