Home All Groups Group Topic Archive Search About

Datasets - use 1 or many?

Author
14 Jun 2006 7:42 PM
Ryan
I'm learning when it comes to Datasets.  Should I just have a single dataset
to handle my entire application data or should I use multiple - a dataset
for each function or form within my application?  Is the data actually
written from and queried to the dataset only when needed per a table
adapter?  It looks like the table adapters .fill method is only invoked when
required, so I assume a single dataset would suffice.  Is this right?

Thanks,
Ryan

Author
14 Jun 2006 8:08 PM
Marina Levit [MVP]
The Fill method is only invoked when you invoke it - so it is up to you to
only do it at the right times.

There is no one right answer, but given very few details as to the nature of
your app, I would say a safe thing to do is to have 1 for each form.  Once a
form is closed, you don't want something in your application holding on to
that data or still keeping it around. Each form should be able to deal with
its own data, and shouldn't need to know about data that belongs to other
forms.

Show quoteHide quote
"Ryan" <Tyveil@newsgroups.nospam> wrote in message
news:eTyeUr%23jGHA.1208@TK2MSFTNGP02.phx.gbl...
> I'm learning when it comes to Datasets.  Should I just have a single
> dataset to handle my entire application data or should I use multiple - a
> dataset for each function or form within my application?  Is the data
> actually written from and queried to the dataset only when needed per a
> table adapter?  It looks like the table adapters .fill method is only
> invoked when required, so I assume a single dataset would suffice.  Is
> this right?
>
> Thanks,
> Ryan
>
Author
14 Jun 2006 8:19 PM
Ryan
Thanks.  This is actually the way I started setting up my project (one
dataset per form).  Since each form should need access to at most 4-5 tables
and I didn't want to include all 20+ tables in a single dataset.

Ryan

Show quoteHide quote
"Marina Levit [MVP]" <someone@nospam.com> wrote in message
news:%23GqGN5%23jGHA.456@TK2MSFTNGP05.phx.gbl...
> The Fill method is only invoked when you invoke it - so it is up to you to
> only do it at the right times.
>
> There is no one right answer, but given very few details as to the nature
> of your app, I would say a safe thing to do is to have 1 for each form.
> Once a form is closed, you don't want something in your application
> holding on to that data or still keeping it around. Each form should be
> able to deal with its own data, and shouldn't need to know about data that
> belongs to other forms.
>
> "Ryan" <Tyveil@newsgroups.nospam> wrote in message
> news:eTyeUr%23jGHA.1208@TK2MSFTNGP02.phx.gbl...
>> I'm learning when it comes to Datasets.  Should I just have a single
>> dataset to handle my entire application data or should I use multiple - a
>> dataset for each function or form within my application?  Is the data
>> actually written from and queried to the dataset only when needed per a
>> table adapter?  It looks like the table adapters .fill method is only
>> invoked when required, so I assume a single dataset would suffice.  Is
>> this right?
>>
>> Thanks,
>> Ryan
>>
>
>
Author
15 Jun 2006 2:43 AM
Kevin Yu [MSFT]
Hi Ryan,

In addition, I suggest you put all relational tables in a DataSet. There is
no requirement for using how many DataSets on a form. It's just for your
convenience, which makes the developer clear of relations between tables.
HTH.

Kevin Yu
Microsoft Online Community Support

============================================================================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
============================================================================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
15 Jun 2006 6:17 AM
Cor Ligthert [MVP]
Kevin and Marina,

I had not seen that you both had answered already while replying.

Probably something in my eyes.

:-)

Others I had written "in addition".

So by this.

Cor

Show quoteHide quote
"Kevin Yu [MSFT]" <v-k***@online.microsoft.com> schreef in bericht
news:%2335ZNWCkGHA.764@TK2MSFTNGXA01.phx.gbl...
> Hi Ryan,
>
> In addition, I suggest you put all relational tables in a DataSet. There
> is
> no requirement for using how many DataSets on a form. It's just for your
> convenience, which makes the developer clear of relations between tables.
> HTH.
>
> Kevin Yu
> Microsoft Online Community Support
>
> ============================================================================
> ==========================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ============================================================================
> ==========================
>
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Author
15 Jun 2006 1:23 PM
Ryan
Just to give you all an example of one of my forms and an idea of what type
of dataset I need:

I have an application form which displays an application sent in by a person
(applying for a position on a public board).  The form needs to display
information from all of the following relational tables:

The Person table containing contact information for that person.
The Application table containing general information about the application
(when and how it was submitted)
The Application_mm_Board table which contains a record for each board this
application is being submitted for.
The Board table which is needed for the name of each board the applicant is
applying for.
The Application_mm_Question table which contains a record for each question
asked on this application
The ApplicationQuestion table which stores the questions themselves.
The ApplicationAnswer table which stores the applicants answers to each
question.
The User table which shows who submitted this application if it was input
manually by a user.

As you can see a even a single dataset for this one form becomes rather
large.  Do you think I should split it up even further for different
functions on the form?  Maybe a different dataset for separate datagridviews
on the form?

Thanks,
Ryan

Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:uvlSaMEkGHA.4040@TK2MSFTNGP05.phx.gbl...
> Kevin and Marina,
>
> I had not seen that you both had answered already while replying.
>
> Probably something in my eyes.
>
> :-)
>
> Others I had written "in addition".
>
> So by this.
>
> Cor
>
> "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> schreef in bericht
> news:%2335ZNWCkGHA.764@TK2MSFTNGXA01.phx.gbl...
>> Hi Ryan,
>>
>> In addition, I suggest you put all relational tables in a DataSet. There
>> is
>> no requirement for using how many DataSets on a form. It's just for your
>> convenience, which makes the developer clear of relations between tables.
>> HTH.
>>
>> Kevin Yu
>> Microsoft Online Community Support
>>
>> ============================================================================
>> ==========================
>> When responding to posts, please "Reply to Group" via your newsreader so
>> that others may learn and benefit from your issue.
>> ============================================================================
>> ==========================
>>
>> (This posting is provided "AS IS", with no warranties, and confers no
>> rights.)
>>
>
>
Author
15 Jun 2006 1:58 PM
Cor Ligthert [MVP]
Ryan,

I would create datasets containing the main table (have a look at paging so
that you can limit them in lenght) and supporting tables. Probably do you in
most cases only need the name from the user, so loading that with all its
data is a waste of time. I assume that the user table contains probably only
the extra data not in the person data. Probably do you need that data
nowhere except there where you modify that and to logon, so it can probably
only contains forever only one row that you have selected with a where
clause (I don't know if you do it already however try to use
uniqueindentifiers which are Guids).

Probably is a lot related round a user, than try to get only the data from
that user with a where clause in your dataset.

(In my idea does a datasets not reflect your organisation as a database
does. A dataset is for me reflecting the way your data is used)

Just my thoughts,

Cor

Show quoteHide quote
"Ryan" <Tyveil@newsgroups.nospam> schreef in bericht
news:u0UcI8HkGHA.3484@TK2MSFTNGP03.phx.gbl...
> Just to give you all an example of one of my forms and an idea of what
> type of dataset I need:
>
> I have an application form which displays an application sent in by a
> person (applying for a position on a public board).  The form needs to
> display information from all of the following relational tables:
>
> The Person table containing contact information for that person.
> The Application table containing general information about the application
> (when and how it was submitted)
> The Application_mm_Board table which contains a record for each board this
> application is being submitted for.
> The Board table which is needed for the name of each board the applicant
> is applying for.
> The Application_mm_Question table which contains a record for each
> question asked on this application
> The ApplicationQuestion table which stores the questions themselves.
> The ApplicationAnswer table which stores the applicants answers to each
> question.
> The User table which shows who submitted this application if it was input
> manually by a user.
>
> As you can see a even a single dataset for this one form becomes rather
> large.  Do you think I should split it up even further for different
> functions on the form?  Maybe a different dataset for separate
> datagridviews on the form?
>
> Thanks,
> Ryan
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:uvlSaMEkGHA.4040@TK2MSFTNGP05.phx.gbl...
>> Kevin and Marina,
>>
>> I had not seen that you both had answered already while replying.
>>
>> Probably something in my eyes.
>>
>> :-)
>>
>> Others I had written "in addition".
>>
>> So by this.
>>
>> Cor
>>
>> "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> schreef in bericht
>> news:%2335ZNWCkGHA.764@TK2MSFTNGXA01.phx.gbl...
>>> Hi Ryan,
>>>
>>> In addition, I suggest you put all relational tables in a DataSet. There
>>> is
>>> no requirement for using how many DataSets on a form. It's just for your
>>> convenience, which makes the developer clear of relations between
>>> tables.
>>> HTH.
>>>
>>> Kevin Yu
>>> Microsoft Online Community Support
>>>
>>> ============================================================================
>>> ==========================
>>> When responding to posts, please "Reply to Group" via your newsreader so
>>> that others may learn and benefit from your issue.
>>> ============================================================================
>>> ==========================
>>>
>>> (This posting is provided "AS IS", with no warranties, and confers no
>>> rights.)
>>>
>>
>>
>
>
Author
15 Jun 2006 2:11 PM
Ryan
Yea actually the User table is only needed as a lookup table to find the
User name (users are backend users of the application, not applicants which
are stored in the person table).  So would you suggest putting lookup tables
in datasets by themselves (for drop-down boxes usually)?  Since lookup
tables usually only need one or two fields from a table.

Ryan

Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:OT4DYOIkGHA.4508@TK2MSFTNGP05.phx.gbl...
> Ryan,
>
> I would create datasets containing the main table (have a look at paging
> so that you can limit them in lenght) and supporting tables. Probably do
> you in most cases only need the name from the user, so loading that with
> all its data is a waste of time. I assume that the user table contains
> probably only the extra data not in the person data. Probably do you need
> that data nowhere except there where you modify that and to logon, so it
> can probably only contains forever only one row that you have selected
> with a where clause (I don't know if you do it already however try to use
> uniqueindentifiers which are Guids).
>
> Probably is a lot related round a user, than try to get only the data from
> that user with a where clause in your dataset.
>
> (In my idea does a datasets not reflect your organisation as a database
> does. A dataset is for me reflecting the way your data is used)
>
> Just my thoughts,
>
> Cor
>
> "Ryan" <Tyveil@newsgroups.nospam> schreef in bericht
> news:u0UcI8HkGHA.3484@TK2MSFTNGP03.phx.gbl...
>> Just to give you all an example of one of my forms and an idea of what
>> type of dataset I need:
>>
>> I have an application form which displays an application sent in by a
>> person (applying for a position on a public board).  The form needs to
>> display information from all of the following relational tables:
>>
>> The Person table containing contact information for that person.
>> The Application table containing general information about the
>> application (when and how it was submitted)
>> The Application_mm_Board table which contains a record for each board
>> this application is being submitted for.
>> The Board table which is needed for the name of each board the applicant
>> is applying for.
>> The Application_mm_Question table which contains a record for each
>> question asked on this application
>> The ApplicationQuestion table which stores the questions themselves.
>> The ApplicationAnswer table which stores the applicants answers to each
>> question.
>> The User table which shows who submitted this application if it was input
>> manually by a user.
>>
>> As you can see a even a single dataset for this one form becomes rather
>> large.  Do you think I should split it up even further for different
>> functions on the form?  Maybe a different dataset for separate
>> datagridviews on the form?
>>
>> Thanks,
>> Ryan
>>
>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
>> news:uvlSaMEkGHA.4040@TK2MSFTNGP05.phx.gbl...
>>> Kevin and Marina,
>>>
>>> I had not seen that you both had answered already while replying.
>>>
>>> Probably something in my eyes.
>>>
>>> :-)
>>>
>>> Others I had written "in addition".
>>>
>>> So by this.
>>>
>>> Cor
>>>
>>> "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> schreef in bericht
>>> news:%2335ZNWCkGHA.764@TK2MSFTNGXA01.phx.gbl...
>>>> Hi Ryan,
>>>>
>>>> In addition, I suggest you put all relational tables in a DataSet.
>>>> There is
>>>> no requirement for using how many DataSets on a form. It's just for
>>>> your
>>>> convenience, which makes the developer clear of relations between
>>>> tables.
>>>> HTH.
>>>>
>>>> Kevin Yu
>>>> Microsoft Online Community Support
>>>>
>>>> ============================================================================
>>>> ==========================
>>>> When responding to posts, please "Reply to Group" via your newsreader
>>>> so
>>>> that others may learn and benefit from your issue.
>>>> ============================================================================
>>>> ==========================
>>>>
>>>> (This posting is provided "AS IS", with no warranties, and confers no
>>>> rights.)
>>>>
>>>
>>>
>>
>>
>
>
Author
15 Jun 2006 2:29 PM
Cor Ligthert [MVP]
Yes

And if they change and you have too the complete information in a where
table,  than change that table too and don't update it.

Cor

Show quoteHide quote
"Ryan" <Tyveil@newsgroups.nospam> schreef in bericht
news:OGw2OXIkGHA.1208@TK2MSFTNGP02.phx.gbl...
> Yea actually the User table is only needed as a lookup table to find the
> User name (users are backend users of the application, not applicants
> which are stored in the person table).  So would you suggest putting
> lookup tables in datasets by themselves (for drop-down boxes usually)?
> Since lookup tables usually only need one or two fields from a table.
>
> Ryan
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:OT4DYOIkGHA.4508@TK2MSFTNGP05.phx.gbl...
>> Ryan,
>>
>> I would create datasets containing the main table (have a look at paging
>> so that you can limit them in lenght) and supporting tables. Probably do
>> you in most cases only need the name from the user, so loading that with
>> all its data is a waste of time. I assume that the user table contains
>> probably only the extra data not in the person data. Probably do you need
>> that data nowhere except there where you modify that and to logon, so it
>> can probably only contains forever only one row that you have selected
>> with a where clause (I don't know if you do it already however try to use
>> uniqueindentifiers which are Guids).
>>
>> Probably is a lot related round a user, than try to get only the data
>> from that user with a where clause in your dataset.
>>
>> (In my idea does a datasets not reflect your organisation as a database
>> does. A dataset is for me reflecting the way your data is used)
>>
>> Just my thoughts,
>>
>> Cor
>>
>> "Ryan" <Tyveil@newsgroups.nospam> schreef in bericht
>> news:u0UcI8HkGHA.3484@TK2MSFTNGP03.phx.gbl...
>>> Just to give you all an example of one of my forms and an idea of what
>>> type of dataset I need:
>>>
>>> I have an application form which displays an application sent in by a
>>> person (applying for a position on a public board).  The form needs to
>>> display information from all of the following relational tables:
>>>
>>> The Person table containing contact information for that person.
>>> The Application table containing general information about the
>>> application (when and how it was submitted)
>>> The Application_mm_Board table which contains a record for each board
>>> this application is being submitted for.
>>> The Board table which is needed for the name of each board the applicant
>>> is applying for.
>>> The Application_mm_Question table which contains a record for each
>>> question asked on this application
>>> The ApplicationQuestion table which stores the questions themselves.
>>> The ApplicationAnswer table which stores the applicants answers to each
>>> question.
>>> The User table which shows who submitted this application if it was
>>> input manually by a user.
>>>
>>> As you can see a even a single dataset for this one form becomes rather
>>> large.  Do you think I should split it up even further for different
>>> functions on the form?  Maybe a different dataset for separate
>>> datagridviews on the form?
>>>
>>> Thanks,
>>> Ryan
>>>
>>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
>>> news:uvlSaMEkGHA.4040@TK2MSFTNGP05.phx.gbl...
>>>> Kevin and Marina,
>>>>
>>>> I had not seen that you both had answered already while replying.
>>>>
>>>> Probably something in my eyes.
>>>>
>>>> :-)
>>>>
>>>> Others I had written "in addition".
>>>>
>>>> So by this.
>>>>
>>>> Cor
>>>>
>>>> "Kevin Yu [MSFT]" <v-k***@online.microsoft.com> schreef in bericht
>>>> news:%2335ZNWCkGHA.764@TK2MSFTNGXA01.phx.gbl...
>>>>> Hi Ryan,
>>>>>
>>>>> In addition, I suggest you put all relational tables in a DataSet.
>>>>> There is
>>>>> no requirement for using how many DataSets on a form. It's just for
>>>>> your
>>>>> convenience, which makes the developer clear of relations between
>>>>> tables.
>>>>> HTH.
>>>>>
>>>>> Kevin Yu
>>>>> Microsoft Online Community Support
>>>>>
>>>>> ============================================================================
>>>>> ==========================
>>>>> When responding to posts, please "Reply to Group" via your newsreader
>>>>> so
>>>>> that others may learn and benefit from your issue.
>>>>> ============================================================================
>>>>> ==========================
>>>>>
>>>>> (This posting is provided "AS IS", with no warranties, and confers no
>>>>> rights.)
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>
Author
15 Jun 2006 6:13 AM
Cor Ligthert [MVP]
Ryan,

One single dataset will probably be very inefficient. Where you cut it is up
to you. Version 2005 goes  back to the datatable (the equivalent of the
recordset) approach. Although that is for external reasons always wrapped
inside a dataset.

I hope this gives an idea, do you want to know more specific things, than
reply

Cor

Show quoteHide quote
"Ryan" <Tyveil@newsgroups.nospam> schreef in bericht
news:eTyeUr%23jGHA.1208@TK2MSFTNGP02.phx.gbl...
> I'm learning when it comes to Datasets.  Should I just have a single
> dataset to handle my entire application data or should I use multiple - a
> dataset for each function or form within my application?  Is the data
> actually written from and queried to the dataset only when needed per a
> table adapter?  It looks like the table adapters .fill method is only
> invoked when required, so I assume a single dataset would suffice.  Is
> this right?
>
> Thanks,
> Ryan
>