If the data is coming from the same database then you can use the same
dataadapter to fill a dataset, however, if you want to update the data in
both datatables and submit those changes then you should use two
dataadapters.
Filling two datatables:
Dim ds As New DataSet()
Dim dap As New xxxDataAdapter("SELECT SomeData From SomeTable",
connectionObj)
dap.Fill(ds, "FirstTable")
dap.SelectCommand.CommandText = "Select SomeData From SomeOtherTable"
dap.Fill(ds, "SecondTable")
Hope this helps
Brian Parlier
"Mike Cooper" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> This is probably an easy question, but I can't find the answer
> anywhere. I have two datatables in my Main_Dataset (untyped). One
> table contains all of the information from the table in my database.
> The other is supposed to contain only 5 columns of information.
>
> The first table, the comprehensive one, fills fine and populates a
> datagrid. The second one does not populate at all. I am attempting
> to fill it will a second (dataadapter).fill command, using a small
> datamap than in the first. So I have two tablemappings, each
> configured the same except one only contains 5 columns.
>
> This does not work, though it also doesn't error, so I have no idea
> what is going on. Is this a valid way to fill a second table in a
> dataset? If not, then how DO you populate multiple tables in a
> dataset? Do you need a second data adapter? This seems wasteful;
> making two calls to the database to retrieve the same information.
>
>
> Thanks,
> Mike Cooper
|