What does DataReader'Read() method do?

 Posted by vishalneeraj-24503 on 12/17/2013 | Category: ADO.NET Interview questions | Views: 1048 | Points: 40
Answer:

Datareader Read() method reads records one-by-one in a forward manner only.
As name suggests Read means reading records from database.
If records found in DB,then Read method returns true otherwise returns false;

if(dr.Read())

{
if(!isdbnull(dr["employee_name"]) employee_name = Convert.toString(dr["employee_name"]);
}


Here dr is our SqldataReader Object.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response