PC Review


Reply
Thread Tools Rate Thread

populating two separate tables from 1 dataset

 
 
Mike Cooper
Guest
Posts: n/a
 
      16th Mar 2004
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
 
Reply With Quote
 
 
 
 
Brian Parlier
Guest
Posts: n/a
 
      16th Mar 2004
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



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populating Junction tables and/or populating two tables at once =?Utf-8?B?Q2hlZXNlX3doaXo=?= Microsoft Access Getting Started 2 4th Oct 2006 04:56 PM
updating info in separate tables in separate databases timglass via AccessMonster.com Microsoft Access External Data 1 1st Nov 2005 09:20 PM
Populating a field from a separate table EJH Microsoft Access 1 20th Aug 2005 05:57 PM
populating a dataset from 2 tables =?Utf-8?B?YW1iZXI=?= Microsoft Dot NET 0 25th Jan 2005 07:45 PM
Automatically populating a dataset with all the mdb's tables =?Utf-8?B?UGhpbCBHcmVn?= Microsoft ADO .NET 1 21st Nov 2004 05:39 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:24 PM.