I have a stored procedure which returns multiple result sets. The code calls the procedure with ExecuteReader(CommandBehavior.CloseConnection), and then proceeds to fill several grids, as follows:
thisgrid.DataSource = dr
thisgrid.DataBind()
dr.NextResult()
thatgrid.DataSource = dr
thatgrid.DataBind()
dr.NextResult()
theothergrid.DataSource = dr
theothergrid.DataBind()
dr.NextResult()
Up until now, we've been using Infragistics grids. But now we're converting to Telerik, and I'm running into a problem. After the first grid is bound, the DataReader closes, and the call to NextResult() results in a "reader is closed" error.
So, my first question is, how do I tell the DataBind method, "Hey, don't close that connection - there are more result sets coming"?
I know that if I remove CommandBehavior.CloseConnection from the ExecuteReader command, the DataReader stays open, but then I'm left with an open connection. So my second question is, how do insure that the connection gets closed? Is it automatically closed when the DataReader closes?
thisgrid.DataSource = dr
thisgrid.DataBind()
dr.NextResult()
thatgrid.DataSource = dr
thatgrid.DataBind()
dr.NextResult()
theothergrid.DataSource = dr
theothergrid.DataBind()
dr.NextResult()
Up until now, we've been using Infragistics grids. But now we're converting to Telerik, and I'm running into a problem. After the first grid is bound, the DataReader closes, and the call to NextResult() results in a "reader is closed" error.
So, my first question is, how do I tell the DataBind method, "Hey, don't close that connection - there are more result sets coming"?
I know that if I remove CommandBehavior.CloseConnection from the ExecuteReader command, the DataReader stays open, but then I'm left with an open connection. So my second question is, how do insure that the connection gets closed? Is it automatically closed when the DataReader closes?