Answer: Dataset is a dis-connected architecture,meaning that we do not have to open connection while dealing with databases.
For Example:-
For ex:-
public DataSet Load_Records(int employee_id)
{
string sql_query = "select employee_name,employee_code,address,ph_no from employe_master where employee_id = "+ employee_id +" and status = 'ÁA'";
//write your connection object
Sqlcommand cmd = new Sqlcommand();
cmd.connction = con;//here con is your connection object
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds,"Employee Master");
return ds;
}
In above function,we can see that,we have not opened connection and closed as well.
Still it will fetch records and fill Dataset.So it's dis-connected architecture.
Asked In: Many Interviews |
Alert Moderator