forum

Home / DeveloperSection / Forums / How i can show Two tables record in GridView

How i can show Two tables record in GridView

Niraj Kumar Mishra 1147 23-Aug-2017
Hi..i have faced a  problem in our c# window application  .
I have two table  Employee and Department and  i want to show both tables all data in a Gridview.
my Query is:
SqlConnection con = new SqlConnection(ConnectionString);
 
      String query = "select * from Employee, Department";
 
      SqlCommand cmd = new SqlCommand(query,con);
 
      SqlDataReader dr;
 
      con.Open();
 
      dr = cmd.ExecuteReader();
 
      GridView1.DataSource = dr;
 
      GridView1.DataBind();
      con.Close();

but it show only first table record in Gridview .
please help...

c# c#  ado.net 
Updated on 23-Aug-2017

Can you answer this question?


Answer

0 Answers

Liked By