reuse SQLDataReader in multiple dropdownlists?

C

Craig Buchanan

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
 
C

Cowboy \(Gregory A. Beamer\)

DataSet. Can bind to as many controls as you wish.

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

**********************************************************************
Think Outside the Box!
**********************************************************************
 
M

Mark Fitzpatrick

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
 
S

Steve C. Orr [MVP, MCSD]

Another solution is that you can bind your second DDL to your first.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top