Hi,
are these operations (this and the one in ItemCreated) sharing the same
connection object, which would get closed unexpectedly?
You don't need to optimize that way (sharing one connection on the page)
necessarily, since connection pooling in .NET will mostly take care of that
e.g it will get you connections efficiently and reuse them. Of course if
there could be numerous of conenction object creations, that's another thing
And with DataAdapters' you don't need to open the connection first before
calling Fill, it is opened for you.
Anyways, to give more exact advice, can you show the code in ItemCreated
using the connection?
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke http://teemukeiski.net
<ma**********@gmail.comwrote in message
news:51**********************************@b64g2000 hsa.googlegroups.com...
Hi
I have a problem with a repeater and a data connection.
In my Page_Load, I have the following code:
Dim connectionString As String =
WebConfig.ConnectionString
Dim connection As SqlConnection = New
SqlConnection(connectionString)
Dim adapter As SqlDataAdapter = New
SqlDataAdapter("SELECT applicationID FROM pvtProductApplication WHERE
productID = " + Request.QueryString("prodId"), connection)
Dim dataSet As DataSet = New DataSet()
connection.Open()
adapter.Fill(dataSet)
ApplicationRepeater.DataSource = dataSet
ApplicationRepeater.DataBind() /* error here */
connection.Close()
and I have a ApplicationRepeater_ItemCreated that also opens a data
connection and closes it. The error is raised as indicated above.
Can someone please help??
Thanks, Mark