B
Bob
I need to get several recordset for which I'm opening a datareader
like so...
OleDbCommand rsA = new OleDbCommand("Select * from Authors",cnAccess);
OleDbDataReader drA = rsA.ExecuteReader();
while(drA.Read())
{
sbL.Append("<tr><td>"+drA["Name"].ToString()+"</td></tr>");
}
This works fine......but when I try for the second recordset like
this....
OleDbCommand rsT = new OleDbCommand("Select * fromTitles",cnAccess);
OleDbDataReader drT = rsT.ExecuteReader();
while(drT.Read())
{
sbL.Append("<tr><td>"+drT["Name"].ToString()+"</td></tr>");
}
I get an error...I "fixed" it by closing...then re-opening the
connection....but do I need to???
Why can't I open the connection and re-use the connection over and
over until I have everything.......as a matter of fact....I should be
able to re-use the dr also....
Anybody know?
Bob Sweeney
like so...
OleDbCommand rsA = new OleDbCommand("Select * from Authors",cnAccess);
OleDbDataReader drA = rsA.ExecuteReader();
while(drA.Read())
{
sbL.Append("<tr><td>"+drA["Name"].ToString()+"</td></tr>");
}
This works fine......but when I try for the second recordset like
this....
OleDbCommand rsT = new OleDbCommand("Select * fromTitles",cnAccess);
OleDbDataReader drT = rsT.ExecuteReader();
while(drT.Read())
{
sbL.Append("<tr><td>"+drT["Name"].ToString()+"</td></tr>");
}
I get an error...I "fixed" it by closing...then re-opening the
connection....but do I need to???
Why can't I open the connection and re-use the connection over and
over until I have everything.......as a matter of fact....I should be
able to re-use the dr also....
Anybody know?
Bob Sweeney