1. sqlconnection con = new sqlconnection();
2. con.connectionstring="connection string text";
3. string query="select *from dbo.names";
4. sqlcommand cmd = new sqlcommand(quey,con);
5. sqldatareader dr = cmd.excutereader();
6. while(dr.read())
7. {
8. console.writeline(dr["names"]);
9. }
10. con.close();
i am confused in line 5 where dr has the refrence to the method executereader() of the sqlcommand class.what is actually happening there when i am calling the read() of the sqldatareader class,can someone give me a detailed explanation on this.i am pretty new to c# and ado.net so i am a bit confused..pllz help.
2. con.connectionstring="connection string text";
3. string query="select *from dbo.names";
4. sqlcommand cmd = new sqlcommand(quey,con);
5. sqldatareader dr = cmd.excutereader();
6. while(dr.read())
7. {
8. console.writeline(dr["names"]);
9. }
10. con.close();
i am confused in line 5 where dr has the refrence to the method executereader() of the sqlcommand class.what is actually happening there when i am calling the read() of the sqldatareader class,can someone give me a detailed explanation on this.i am pretty new to c# and ado.net so i am a bit confused..pllz help.