How i can show Two tables record in GridView

Total Post:9

Points:63
C#  ADO.Net 
C#
 319  View(s)
Ratings:
Rate this:
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...

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!