Users Pricing

forum

Home Forums How i can show Two tables record in GridView – MindStick

How i can show Two tables record in GridView

Niraj Kumar Mishra 1569 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...

0 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md