ASP.NET Drop Down List Fill Method

C

csgraham74

Hi Guys,

I am currently building a web aplication in ASP.Net. On the onload
event of a page a have a function to populate the many drop down lists
on my page.

I have one parameter table which stores all the values e.g.
Title,Type,Status,Property,Occupation.

I am using a sql string and then populationg my drop down list
e.g.

strSQLQuery = "SELECT * FROM tbl_Parameters WHERE str_ParamType =
'Status'"

The problem that i am having is how best to populate each drop down
list efficiently as i am constantly opening and closing the connection
for each new sql String.

Can anyone point me in the best (or quickest and most efficinet) way to
populate multiple drop down list.

any thanks appreciated


CG
 
S

Steve C. Orr [MVP, MCSD]

If they are lists of data that are used a lot and shared among users, you
could cache them in application state or the cache object in the form of a
DataTable.

Otherwise what you're doing is reasonably efficient. ADO.NET pools database
connections so you're not actually opening and closing as many connections
as you think you are.
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top