Answer: It returns only SqlDataReader Object.It is associated with Sqlcommand object.
For ex:-
string sql_query = "select employee_name,employee_code from employe_master where employee_id = 1 and status = 'ÁA';
//write your connection object
Sqlcommand cmd = new Sqlcommand();
cmd.connction = con;//here con is your connection object
con.open();
SqlDataReader dr = cmd.ExcuteReader();
If(dr.Read())
{
string employee_code = Convert.ToString(dr["employee_code"]);
string employee_name = Convert.ToString(dr["employee_name"]);
dr.Close();
}
con.Close();
Asked In: Many Interviews |
Alert Moderator