derwejoipolaserf
New Member
I want to make round trips to the database and use the SqlDataReader in seperate functions such as onselectedindexchanged of dropdownlist objects. Can I reuse the same database connection, or do I need to declare a new connection, open it, and close it in each seperate function? If I can reuse it, how and where do I declare it in the program? Thanks for any help!I have the same question. I would love to see an answer.You would not want to keep a connection open all the time. What you could do is declare your connection globally(outside of any function) like so:<BR><BR>SqlConnection oConn = new SqlConnection("connectionstring");<BR><BR>Then in your function just say<BR><BR>oConn.Open();<BR><BR>Do stuff here<BR><BR>oConn.Close();