A
Axel Dahmen
Hi,
I created an ASP.NET page containing an asp:Repeater control... This control
contains a Web user control of mine which itself contains an asp:Repeater
control... That control in turn contains a second Web user control of mine
which again contains an asp:Repeater control...
When I run the page, I get an error telling me that get_FieldCount() can't
be performed on a closed SqlDataReader (this error is raised the page).
However, I did't close any of them. I'm just using three distinct
SqlDataReaders on the same connection string (but distinct SqlConnection
objects) simultaneously. Isn't that possible?
TIA
Axel Dahmen
====
The hierarchy looks something like:
Page.aspx
|------- WUC1.ascx
|-------- WUC2.ascx
All three of them contain code similar to the following:
using (SqlConnection con=new SqlConnection(conStr))
{
SqlCommand cmd;
cmd=con.CreateCommand();
cmd.CommandText="...";
con.Open();
repeater.DataSource=cmd.ExecuteReader();
repeater.DataBind();
}
All three of them use the <%# DataBinder.Eval()%> syntax to perform
databinding:
<asp:Repeater Runat="server" ID="repeater" EnableViewState="False">
<ItemTemplate>
<axd:Item Runat="server" MyProp='<%#
DataBinder.Eval(Container.DataItem,"MyCol")%>'/>
</ItemTemplate>
</asp:Repeater>
I created an ASP.NET page containing an asp:Repeater control... This control
contains a Web user control of mine which itself contains an asp:Repeater
control... That control in turn contains a second Web user control of mine
which again contains an asp:Repeater control...
When I run the page, I get an error telling me that get_FieldCount() can't
be performed on a closed SqlDataReader (this error is raised the page).
However, I did't close any of them. I'm just using three distinct
SqlDataReaders on the same connection string (but distinct SqlConnection
objects) simultaneously. Isn't that possible?
TIA
Axel Dahmen
====
The hierarchy looks something like:
Page.aspx
|------- WUC1.ascx
|-------- WUC2.ascx
All three of them contain code similar to the following:
using (SqlConnection con=new SqlConnection(conStr))
{
SqlCommand cmd;
cmd=con.CreateCommand();
cmd.CommandText="...";
con.Open();
repeater.DataSource=cmd.ExecuteReader();
repeater.DataBind();
}
All three of them use the <%# DataBinder.Eval()%> syntax to perform
databinding:
<asp:Repeater Runat="server" ID="repeater" EnableViewState="False">
<ItemTemplate>
<axd:Item Runat="server" MyProp='<%#
DataBinder.Eval(Container.DataItem,"MyCol")%>'/>
</ItemTemplate>
</asp:Repeater>