im getting the exception cannot find table 0.
My code is
con = new SqlConnection(strConString);
con.Open();
cmd = new SqlCommand("select * from Empdetails", con);
cmd.CommandType = CommandType.Text;
Da = new SqlDataAdapter(cmd);
Ds = new DataSet();
Da.Fill(Ds, "Empdetails");
cmd = new SqlCommand("select * from EmpTable", con);
cmd.CommandType = CommandType.Text;
Da = new SqlDataAdapter(cmd);
Ds = new DataSet();
Da.Fill(Ds, "EmpTable");
Grdtables.DataSource = Ds.Tables[0];
Grdtables.DataBind();
con.Close();
Ds.Tables[0].Merge(Ds.Tables[1]);
Dt = Ds.Tables[0];
for (i = 0; i <= Dt.Rows.Count - 1; i++)
{
Response.Write(Dt.Rows[i].ItemArray[0] + " -- " + Dt.Rows[i].ItemArray[1]);
}
}
Regards,
Pavan.


Salman BegRank #284 · 8.8K reputationPosted Oct 24, 2016, 5:36 AM EDT
Pavan BujjiRank #9,604 · 204 reputationPosted Oct 24, 2016, 5:44 AM EDT
Salman BegRank #284 · 8.8K reputationPosted Oct 24, 2016, 5:57 AM EDT
Pavan BujjiRank #9,604 · 204 reputationPosted Oct 24, 2016, 6:03 AM EDT
Salman BegRank #284 · 8.8K reputationPosted Oct 24, 2016, 6:35 AM EDT
Manas MohapatraRank #182 · 13.2K reputationPosted Oct 24, 2016, 6:44 AM EDT