ASP.Net / C# - How do you cache a DataReader ?
Posted on 2005-03-24
I'm selecting thousands of records using a data reader to populate a grid. How do I cache the data reader so I can just rebind after postbacks, without having to make a db call? Thanks!
string SQL = "Select * from prospect order by prolast";
OleDbCommand cmd = new OleDbCommand(SQL,oledbconn);
cmd.CommandType = CommandType.Text;
this.Grid.DataSource = cmd.ExecuteReader();
Cache["dr"] = cmd.ExecuteReader() ???????? this will call read ! ,,,then how do I cast it back to the grids.datasource ?