Bobindra Kumar

Bobindra Kumar

  • 1.4k
  • 324
  • 12.4k

How to bind dataset multiple table in one gridview control

Apr 24 2018 8:22 AM
store producer return multiple table at a time
and i got these all table in my one dataset
so how i bind this dataset all table in my gridview
All table sturecture are not same
 
below is my code
public DataSet getdata(string actext, string feestext, string attandancetext, string examinationtext)
{
SqlConnection con = new SqlConnection(Commonfunction.getConnectionstring());
SqlCommand cmd = new SqlCommand("Sp_StudentReportCard", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Academic", actext);
cmd.Parameters.AddWithValue("@Fees", feestext);
cmd.Parameters.AddWithValue("@Attandance", attandancetext);
cmd.Parameters.AddWithValue("@Examination", examinationtext);
SqlDataAdapter adap = new SqlDataAdapter(cmd);
DataTable dt=new DataTable();
DataSet ds=new DataSet();
adap.Fill(ds);
foreach (DataTable table in ds.Tables)
{
for (int i = 0; i < ds.Tables.Count; i++)
{
dt = ds.Tables[i];
}
}
return ds;
 

Answers (1)