SqlDataAdapter adap = new SqlDataAdapter("Select * from Contentpagenav;Select * from Employees",conn);
DataSet ds = new DataSet();
conn.Open();
adap.TableMappings.Add("ContentPagenav", "Table1");
adap.TableMappings.Add("Employees", "Table2");
adap.Fill(ds, "Table1");
adap.Fill(ds, "Table2");
GridView1.DataSource = ds.Tables["Table1"];
GridView1.DataBind();
GridView2.DataSource = ds.Tables["Table2"];
GridView2.DataBind();
conn.Close();
I am getting the first table data in both the gridviews. What am I doing wrong?
did you tried by doing this
Edit 1: There are some mistakes with your code
For more understandings Table Mapping in ADO.NET