G
Guest
Hi,
I am not able to understand why a datareader needs a connection to the DB
all the time. Here is what I tried.
Sqlcommand cmd = ("select * from table1",con)
// where con is the connection object
1. DataReader dr = cmd.executereader();
2.while(dr.read()) { // do something //}
I have a break point in line 2. when i run my application and once it hits
the break point (i.e line 2) I opened query analyzer and deleted all the rows
in table1. Now, if i continue with the execution of the above program it was
still able to bring all the rows from table1. How does this happen. I even
tried putting commit after deleting the rows but still the datareader is
bringing back the rows. Can any one please explain me this.
Thanks
I am not able to understand why a datareader needs a connection to the DB
all the time. Here is what I tried.
Sqlcommand cmd = ("select * from table1",con)
// where con is the connection object
1. DataReader dr = cmd.executereader();
2.while(dr.read()) { // do something //}
I have a break point in line 2. when i run my application and once it hits
the break point (i.e line 2) I opened query analyzer and deleted all the rows
in table1. Now, if i continue with the execution of the above program it was
still able to bring all the rows from table1. How does this happen. I even
tried putting commit after deleting the rows but still the datareader is
bringing back the rows. Can any one please explain me this.
Thanks