Is there any way to access a SqlDataReader
after the connection is closed?
Or is there any objects equivalent to SqlDataReader
that I can store the reader into them and process on the objects later?
I'm receiving a pivot dataset from the server, so I can't use normal classes to process this kind of data, my model looks like this :
public class OneToNinetyNine
{
public List<Cities> listCities;
public string CityID;
public DateTime DateFrom;
public DateTime DateTo;
// this is the reader that I attempt to pass to the views
public SqlDataReader SqlReader;
}
You can't use the DataReader
after the connection is closed, as it needs to use the connection to retrieve the data from the data source.
You need to read the data into a DataSet
, or DataTable
using the Load
method, then you can close the connection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With