Click here to Skip to main content
16,005,162 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi to all,

i have more tables in MYSQL

1st datatable with columns like, Deptno studentNo studentName

2nd datatable with columns like, Deptno DeptName DeptAddress

3rd datatable with columns like,
Deptno staffname staffAddress staffQulification

add data to both the tables Dynamically

and merge these tables into one table and display it in Grid view
as
Deptno studentNo studentName
Deptno DeptName DeptAddress
Deptno staffname staffAddress staffQulification

Thanks in advance
Sundaramoorthy.B
Posted
Comments
[no name] 7-Aug-12 11:24am    
Does this mean that instead of a question you just want someone to write an SQL query for you?

1 solution

I think you want to select columns from different datatable and merge it as single datatable and bind it to gridview.


Then you have to use merge keyword.

C#
DataTable dt1=//some datatable
DataTable dt2=//some datatable
DataTable dt3=//some datatable

dt1.Merge(dt2);
dt1.Merge(dt3);

GridView1.DataSource=dt1;
GridView1.DataBind();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900