C
corey.burnett
Here is my situation:
I have a .NET application that queries a WebService to get the data for
the application. The WebService does not support Joins of any type
even though the data in the back end is relational. The WebService
only allows you to select data from one table at a time. So I'm trying
to come up with a way that I can get the necessary data, put it in to
DataTables that live in a DataSet and then set the necessary
DataRelations. Then I'd like to be able to bind the correct "view" of
the data to a grid. It's this very last step that has me stumped.
Here is some sample code:
Dim myDataSet as New DataSet
Dim EmployeeDataTable as DataTable = myWebService.GetData("SELECT *
FROM Employee")
myDataSet.Tables.Add(EmployeeDataTable)
Dim OfficeDataTable as DataTable = myWebService.GetData("SELECT * FROM
Office")
myDataSet.Tables.Add(OfficeDataTable)
'Now add the DataRelation
Dim myRelation as DataRelation = New DataRelation("OfficeEmployee",
OfficeDataTable.Columns("OfficeID"),
EmployeeDataTable.Columns("OfficeID"))
myDataSet.DataRelations.Add(myRelation)
myDataGrid.DataSource = ????
myDataGrid.DataBind()
I want the Grid to show all of the employees with their information
including the lookup to the Office table to get the office name. Can
this be done? Do I have to use some sort of "view" on the data set to
tell it to what fields to select from the different tables?
Thanks,
Corey
I have a .NET application that queries a WebService to get the data for
the application. The WebService does not support Joins of any type
even though the data in the back end is relational. The WebService
only allows you to select data from one table at a time. So I'm trying
to come up with a way that I can get the necessary data, put it in to
DataTables that live in a DataSet and then set the necessary
DataRelations. Then I'd like to be able to bind the correct "view" of
the data to a grid. It's this very last step that has me stumped.
Here is some sample code:
Dim myDataSet as New DataSet
Dim EmployeeDataTable as DataTable = myWebService.GetData("SELECT *
FROM Employee")
myDataSet.Tables.Add(EmployeeDataTable)
Dim OfficeDataTable as DataTable = myWebService.GetData("SELECT * FROM
Office")
myDataSet.Tables.Add(OfficeDataTable)
'Now add the DataRelation
Dim myRelation as DataRelation = New DataRelation("OfficeEmployee",
OfficeDataTable.Columns("OfficeID"),
EmployeeDataTable.Columns("OfficeID"))
myDataSet.DataRelations.Add(myRelation)
myDataGrid.DataSource = ????
myDataGrid.DataBind()
I want the Grid to show all of the employees with their information
including the lookup to the Office table to get the office name. Can
this be done? Do I have to use some sort of "view" on the data set to
tell it to what fields to select from the different tables?
Thanks,
Corey