S
STom
I am using a SQLDataAdapter to call a stored procedure that has 5 select
statements. I can see that the dataset does contain 5 sets of data, but I
want to name the tables in the dataset that this data goes into.
If I start off doing this:
adpModel = New SqlDataAdapter
hierDS = New DataSet
adpModel.TableMappings.Add("tblModels", "DataTblModels")
adpModel.TableMappings.Add("tblCaseData", "DataTblCaseData")
adpModel.TableMappings.Add("tblCompanyProfile", "DataTblCompanyProfile")
adpModel.TableMappings.Add("tblModelIndustryStandards",
"DataTblModelIndustryStandards")
adpModel.TableMappings.Add("tblDynamicModel", "DataTblDynamicModel")
With adpModel
'add a SelectCommand
..SelectCommand = New SqlCommand
' Specify the Select Command
With .SelectCommand
.CommandType = CommandType.StoredProcedure
.CommandText = "GetModelData"
.Connection = New SqlConnection(lclModel.ConnString)
End With
' Populate the DataSet with the returned data
..Fill(hierDS, "MyModel")
MyModel ends up having MyModel1, MyModel2 etc. How can I tie the table
mappings to the actually dataset being filled? Each table has a ModelID so
basically tblModels is the parent table and the rest are children tables. Do
I have to create a relationship?
Thanks.
STom
statements. I can see that the dataset does contain 5 sets of data, but I
want to name the tables in the dataset that this data goes into.
If I start off doing this:
adpModel = New SqlDataAdapter
hierDS = New DataSet
adpModel.TableMappings.Add("tblModels", "DataTblModels")
adpModel.TableMappings.Add("tblCaseData", "DataTblCaseData")
adpModel.TableMappings.Add("tblCompanyProfile", "DataTblCompanyProfile")
adpModel.TableMappings.Add("tblModelIndustryStandards",
"DataTblModelIndustryStandards")
adpModel.TableMappings.Add("tblDynamicModel", "DataTblDynamicModel")
With adpModel
'add a SelectCommand
..SelectCommand = New SqlCommand
' Specify the Select Command
With .SelectCommand
.CommandType = CommandType.StoredProcedure
.CommandText = "GetModelData"
.Connection = New SqlConnection(lclModel.ConnString)
End With
' Populate the DataSet with the returned data
..Fill(hierDS, "MyModel")
MyModel ends up having MyModel1, MyModel2 etc. How can I tie the table
mappings to the actually dataset being filled? Each table has a ModelID so
basically tblModels is the parent table and the rest are children tables. Do
I have to create a relationship?
Thanks.
STom