How to Join Two Table in Dataset and show in Gridview Joined Both Tables...
-
I have two table Employee and EmployeeAddress and Both Cotain ID filed with integer, I want to Join both in DataSet How can i do it ??? select * from Employee, EmployeeAddress where Employee.ID= EmployeeAddress.ID I want to do the the above sql operation in my Dataset & need to display in girdview My Dataset Contain two Table one is for Results of Employee another table contains details of EmployeeAddress. How can Provide First Table as Primary and Second Table as Forign Key I tried that Dataset objds=new Dataset(); ...... ...... //Analyse that Dataset contain two tables of data now then How can I provide relation and need to give to Gridview objds.Relations.Add("Relation",objds.Tables[0].Column["ID"],objds.Tables[1].Column["ID"]); Gridview1.Datasource = objds; Gridview1.DataBind(); But it showing only First Table Data only I want to Join both tables as one and need to show in Gridview How can do It ? Regars, Shaik Haneef sk.haneef@gmail.com
-
I have two table Employee and EmployeeAddress and Both Cotain ID filed with integer, I want to Join both in DataSet How can i do it ??? select * from Employee, EmployeeAddress where Employee.ID= EmployeeAddress.ID I want to do the the above sql operation in my Dataset & need to display in girdview My Dataset Contain two Table one is for Results of Employee another table contains details of EmployeeAddress. How can Provide First Table as Primary and Second Table as Forign Key I tried that Dataset objds=new Dataset(); ...... ...... //Analyse that Dataset contain two tables of data now then How can I provide relation and need to give to Gridview objds.Relations.Add("Relation",objds.Tables[0].Column["ID"],objds.Tables[1].Column["ID"]); Gridview1.Datasource = objds; Gridview1.DataBind(); But it showing only First Table Data only I want to Join both tables as one and need to show in Gridview How can do It ? Regars, Shaik Haneef sk.haneef@gmail.com
I don't think the GridView supports this, but you can try adding databound columns at design-time, this might permit you to bind some columns to the first table and some to the second. I doubt it tho.
-
I have two table Employee and EmployeeAddress and Both Cotain ID filed with integer, I want to Join both in DataSet How can i do it ??? select * from Employee, EmployeeAddress where Employee.ID= EmployeeAddress.ID I want to do the the above sql operation in my Dataset & need to display in girdview My Dataset Contain two Table one is for Results of Employee another table contains details of EmployeeAddress. How can Provide First Table as Primary and Second Table as Forign Key I tried that Dataset objds=new Dataset(); ...... ...... //Analyse that Dataset contain two tables of data now then How can I provide relation and need to give to Gridview objds.Relations.Add("Relation",objds.Tables[0].Column["ID"],objds.Tables[1].Column["ID"]); Gridview1.Datasource = objds; Gridview1.DataBind(); But it showing only First Table Data only I want to Join both tables as one and need to show in Gridview How can do It ? Regars, Shaik Haneef sk.haneef@gmail.com
Make sure that ID refers to the correct ID in both tables, on if then will be the ID for address and the other will be the ID for the customer. There should be a CustomerID on the address table! You need to have done some study during your course, surely!
Never underestimate the power of human stupidity RAH
-
I have two table Employee and EmployeeAddress and Both Cotain ID filed with integer, I want to Join both in DataSet How can i do it ??? select * from Employee, EmployeeAddress where Employee.ID= EmployeeAddress.ID I want to do the the above sql operation in my Dataset & need to display in girdview My Dataset Contain two Table one is for Results of Employee another table contains details of EmployeeAddress. How can Provide First Table as Primary and Second Table as Forign Key I tried that Dataset objds=new Dataset(); ...... ...... //Analyse that Dataset contain two tables of data now then How can I provide relation and need to give to Gridview objds.Relations.Add("Relation",objds.Tables[0].Column["ID"],objds.Tables[1].Column["ID"]); Gridview1.Datasource = objds; Gridview1.DataBind(); But it showing only First Table Data only I want to Join both tables as one and need to show in Gridview How can do It ? Regars, Shaik Haneef sk.haneef@gmail.com