What I'm actually advocating is not reusing the same one. You have the
postback to deal with so go ahead and just create the connection and call
executereader. Justmake sure you close that connection ie using
(SqlConnection cn = new SqlConnection()) so you know it gets disposed of.
--
W.G. Ryan MVP (Windows Embedded)
TiBA Solutions
www.tibasolutions.com |
www.devbuzz.com |
www.knowdotnet.com
yes i am creating a connection and a command, then binding the
datagrid to the command's executeReader.
you suggest that creating another connection is little cost. Is this
because I can't use the existing connection? If I can use it, please
explain how. Thanks.
On Wed, 13 Oct 2004 19:36:44 -0400, "W.G. Ryan eMVP"
You aren't binding to a Command or a SqlConnection per se. I'm guessing
you
are using cmd.ExecuteReader witht he ASP.NET Web Grid? The main thing to
remember is close the connection as soon as you're done - because of
pooling
you can create another connection at very little cost
--
W.G. Ryan MVP (Windows Embedded)
TiBA Solutions
www.tibasolutions.com |
www.devbuzz.com |
www.knowdotnet.com
i am binding a datagrid do a sqlcommand, which uses a sql connection.
fine.
if i want to run another query and bind another datagrid, do i have to
create new connections and commands? because i can't seem to get it to
work using just one connection