Home All Groups Group Topic Archive Search About

Created Dataset with two tables - How do I populate at runtime?

Author
7 Jun 2006 10:00 PM
dchman
In VS 2005, I created a dataset with the dataset designer that has two tables
that have a parent-child relationship (which I also added in the designer). 
Each table gets data from a stored procedure.  I want to populate the dataset
at runtime, passing in a parameter from another control on the form, then
pass the dataset to a crystal report.  And that is what I haven't figured out
- how to populate the dataset at run time.  Can someone point me in the right
direction?

thanks
--
dchman

Author
8 Jun 2006 12:17 AM
Cowboy (Gregory A. Beamer)
There are a couple of ways.

1. Pass the DataSet to two different DataAdapters and let them populate each
table.
2. Get the data independently and "migrate" to the DataSet
3. Call a single sproc to fill both tables.

Of the options, I like three the best (one trip) in most cases. Fill the
parent before the child.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
Show quote
"dchman" <dch***@discussions.microsoft.com> wrote in message
news:24AF9354-0753-41C6-BB6F-C7390D85B43E@microsoft.com...
> In VS 2005, I created a dataset with the dataset designer that has two
> tables
> that have a parent-child relationship (which I also added in the
> designer).
> Each table gets data from a stored procedure.  I want to populate the
> dataset
> at runtime, passing in a parameter from another control on the form, then
> pass the dataset to a crystal report.  And that is what I haven't figured
> out
> - how to populate the dataset at run time.  Can someone point me in the
> right
> direction?
>
> thanks
> --
> dchman
Author
8 Jun 2006 6:35 PM
dchman
thanks for the tip.  I used Item 3 as you suggested, which worked like a
charm.  I wasn't aware that I could do populate two tables in one dataset so
easily. 

--
dchman


Show quote
"Cowboy (Gregory A. Beamer)" wrote:

> There are a couple of ways.
>
> 1. Pass the DataSet to two different DataAdapters and let them populate each
> table.
> 2. Get the data independently and "migrate" to the DataSet
> 3. Call a single sproc to fill both tables.
>
> Of the options, I like three the best (one trip) in most cases. Fill the
> parent before the child.
>
> --
> Gregory A. Beamer
>
> *************************************************
> Think Outside the Box!
> *************************************************
> "dchman" <dch***@discussions.microsoft.com> wrote in message
> news:24AF9354-0753-41C6-BB6F-C7390D85B43E@microsoft.com...
> > In VS 2005, I created a dataset with the dataset designer that has two
> > tables
> > that have a parent-child relationship (which I also added in the
> > designer).
> > Each table gets data from a stored procedure.  I want to populate the
> > dataset
> > at runtime, passing in a parameter from another control on the form, then
> > pass the dataset to a crystal report.  And that is what I haven't figured
> > out
> > - how to populate the dataset at run time.  Can someone point me in the
> > right
> > direction?
> >
> > thanks
> > --
> > dchman
>
>
>
Author
9 Jun 2006 1:15 PM
Cowboy (Gregory A. Beamer)
Unfortunately, the MS literature is WAY too focused on filling a single
table. Glad it worked for you.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
Show quote
"dchman" <dch***@discussions.microsoft.com> wrote in message
news:D8F8ABB8-71B9-43A0-9847-E057AB3D4BA0@microsoft.com...
> thanks for the tip.  I used Item 3 as you suggested, which worked like a
> charm.  I wasn't aware that I could do populate two tables in one dataset
> so
> easily.
>
> --
> dchman
>
>
> "Cowboy (Gregory A. Beamer)" wrote:
>
>> There are a couple of ways.
>>
>> 1. Pass the DataSet to two different DataAdapters and let them populate
>> each
>> table.
>> 2. Get the data independently and "migrate" to the DataSet
>> 3. Call a single sproc to fill both tables.
>>
>> Of the options, I like three the best (one trip) in most cases. Fill the
>> parent before the child.
>>
>> --
>> Gregory A. Beamer
>>
>> *************************************************
>> Think Outside the Box!
>> *************************************************
>> "dchman" <dch***@discussions.microsoft.com> wrote in message
>> news:24AF9354-0753-41C6-BB6F-C7390D85B43E@microsoft.com...
>> > In VS 2005, I created a dataset with the dataset designer that has two
>> > tables
>> > that have a parent-child relationship (which I also added in the
>> > designer).
>> > Each table gets data from a stored procedure.  I want to populate the
>> > dataset
>> > at runtime, passing in a parameter from another control on the form,
>> > then
>> > pass the dataset to a crystal report.  And that is what I haven't
>> > figured
>> > out
>> > - how to populate the dataset at run time.  Can someone point me in the
>> > right
>> > direction?
>> >
>> > thanks
>> > --
>> > dchman
>>
>>
>>

AddThis Social Bookmark Button