Dataset is a dis-connected architecture,meaning that we do not have to open connection while dealing with databases.
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();
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 |