DataSet

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

I have a db that I retrieve data from multiple times. I have a bunch of
combo boxes that I bind datasets to and when the user selects the data I
retrieve data from the dataset linked to that combo box. Now my question is
it better to have mutliple dataset or when I retrieve each dataset I just
add that dataset to one major dataset so when it is time to retieve the data
I just have one dataset to look up data? My concerns are performance as
well.

Thanks
 
Are you referring to lookup data that is used to populate your comboboxes?
If yes, we do all this up front on a seperate thread and then cache the
lookup DataSet. We then bind to whatever lookup Datatable we need in this
Lookup Dataset.
 
Thanks for your response. I think my question was a bit confusing. What I
want to know is better to have one dataset then having multiple datsets.
What I mean by this is:

I have combo boxes that will be binded to datasets based on user input.
After I bind them I use the datsets for data after the user selects an item
in the combobox. Initially I saved each dataset however I was thinking it
could create a base dataset and just merge each dataset to it and then query
to get the results I need. I was wondering if this is a better approach and
is it performance wise better?

Thanks
 
You could create multiple DataAdapter object based on different data
source, and add the DataTables into a same DataSet by calling
DataAdapter.Fill method. In this way, multiple combobox controls can based
on the DataTables in a same DataSet. It works fine on my side. For example:

=============
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'''''DataTable1
SqlDataAdapter1.Fill(DataSet1, "Table1")

ComboBox1.DataSource = DataTable1
ComboBox1.DisplayMember = "Customer"
ComboBox1.ValueMember = "CustomerID"

'''''DataTable2
Dim DataTable2 As New System.Data.DataTable
DataSet2.Tables.Add(DataTable2)
DataTable2.TableName = "Employee"

SqlDataAdapter2.Fill(DataSet2, "Employee")

ComboBox2.DataSource = DataTable2
ComboBox2.ValueMember = "EmployeeID"

''''''DataTable3
Dim DataTable3 As New System.Data.DataTable
DataSet1.Tables.Add(DataTable3)
DataTable3.TableName = "Employee"

SqlDataAdapter2.Fill(DataSet1, "Employee")

ComboBox3.DataSource = DataTable3
ComboBox3.ValueMember = "EmployeeID"


End Sub
==================



Sincerely,

Kevin
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! - www.microsoft.com/security

--------------------
| From: "Tim" <[email protected]>
| References: <uxG#[email protected]>
<[email protected]>
| Subject: Re: DataSet
| Date: Thu, 16 Oct 2003 14:57:44 -0600
| Lines: 42
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: 64.207.45.37
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63810
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Thanks for your response. I think my question was a bit confusing. What
I
| want to know is better to have one dataset then having multiple datsets.
| What I mean by this is:
|
| I have combo boxes that will be binded to datasets based on user input.
| After I bind them I use the datsets for data after the user selects an
item
| in the combobox. Initially I saved each dataset however I was thinking it
| could create a base dataset and just merge each dataset to it and then
query
| to get the results I need. I was wondering if this is a better approach
and
| is it performance wise better?
|
| Thanks
|
| | > Are you referring to lookup data that is used to populate your
comboboxes?
| > If yes, we do all this up front on a seperate thread and then cache the
| > lookup DataSet. We then bind to whatever lookup Datatable we need in
this
| > Lookup Dataset.
| >
| >
| > | > > I have a db that I retrieve data from multiple times. I have a bunch
of
| > > combo boxes that I bind datasets to and when the user selects the
data I
| > > retrieve data from the dataset linked to that combo box. Now my
| question
| > is
| > > it better to have mutliple dataset or when I retrieve each dataset I
| just
| > > add that dataset to one major dataset so when it is time to retieve
the
| > data
| > > I just have one dataset to look up data? My concerns are performance
as
| > > well.
| > >
| > > Thanks
| > >
| > >
| >
| >
|
|
|
 
Thanks for the reply. Merging datasets also work and my real question is it
better (design/performance) to have a dataset for each combo box or have one
for everything?

Thanks

Kevin Sun said:
You could create multiple DataAdapter object based on different data
source, and add the DataTables into a same DataSet by calling
DataAdapter.Fill method. In this way, multiple combobox controls can based
 
Personally, I link to keeps things clean and seperate. Makes maintenance
much easier. That said, I would use seperate DataSets.
 
Hi,

In this case, it is better to have a dataset for each combo box. It is
easier for you to manager the data and it also uses less resource.


Sincerely,

Kevin
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! - www.microsoft.com/security

--------------------
| From: "Eric" <[email protected]>
| References: <uxG#[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
| Subject: Re: DataSet
| Date: Fri, 17 Oct 2003 09:26:34 -0600
| Lines: 140
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.adonet
| NNTP-Posting-Host: 64.207.45.37
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.adonet:63888
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
|
| Thanks for the reply. Merging datasets also work and my real question is
it
| better (design/performance) to have a dataset for each combo box or have
one
| for everything?
|
| Thanks
|
| | > You could create multiple DataAdapter object based on different data
| > source, and add the DataTables into a same DataSet by calling
| > DataAdapter.Fill method. In this way, multiple combobox controls can
based
| > on the DataTables in a same DataSet. It works fine on my side. For
| example:
| >
| > =============
| > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
| > System.EventArgs) Handles MyBase.Load
| >
| > '''''DataTable1
| > SqlDataAdapter1.Fill(DataSet1, "Table1")
| >
| > ComboBox1.DataSource = DataTable1
| > ComboBox1.DisplayMember = "Customer"
| > ComboBox1.ValueMember = "CustomerID"
| >
| > '''''DataTable2
| > Dim DataTable2 As New System.Data.DataTable
| > DataSet2.Tables.Add(DataTable2)
| > DataTable2.TableName = "Employee"
| >
| > SqlDataAdapter2.Fill(DataSet2, "Employee")
| >
| > ComboBox2.DataSource = DataTable2
| > ComboBox2.ValueMember = "EmployeeID"
| >
| > ''''''DataTable3
| > Dim DataTable3 As New System.Data.DataTable
| > DataSet1.Tables.Add(DataTable3)
| > DataTable3.TableName = "Employee"
| >
| > SqlDataAdapter2.Fill(DataSet1, "Employee")
| >
| > ComboBox3.DataSource = DataTable3
| > ComboBox3.ValueMember = "EmployeeID"
| >
| >
| > End Sub
| > ==================
| >
| >
| >
| > Sincerely,
| >
| > Kevin
| > Microsoft Support
| >
| > This posting is provided "AS IS" with no warranties, and confers no
| rights.
| > Get Secure! - www.microsoft.com/security
| >
| > --------------------
| > | From: "Tim" <[email protected]>
| > | References: <uxG#[email protected]>
| > <[email protected]>
| > | Subject: Re: DataSet
| > | Date: Thu, 16 Oct 2003 14:57:44 -0600
| > | Lines: 42
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| > | Message-ID: <[email protected]>
| > | Newsgroups: microsoft.public.dotnet.framework.adonet
| > | NNTP-Posting-Host: 64.207.45.37
| > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| > | Xref: cpmsftngxa06.phx.gbl
| microsoft.public.dotnet.framework.adonet:63810
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| > |
| > | Thanks for your response. I think my question was a bit confusing.
| What
| > I
| > | want to know is better to have one dataset then having multiple
datsets.
| > | What I mean by this is:
| > |
| > | I have combo boxes that will be binded to datasets based on user
input.
| > | After I bind them I use the datsets for data after the user selects an
| > item
| > | in the combobox. Initially I saved each dataset however I was
thinking
| it
| > | could create a base dataset and just merge each dataset to it and then
| > query
| > | to get the results I need. I was wondering if this is a better
approach
| > and
| > | is it performance wise better?
| > |
| > | Thanks
| > |
| > | | > | > Are you referring to lookup data that is used to populate your
| > comboboxes?
| > | > If yes, we do all this up front on a seperate thread and then cache
| the
| > | > lookup DataSet. We then bind to whatever lookup Datatable we need
in
| > this
| > | > Lookup Dataset.
| > | >
| > | >
| > | > | > | > > I have a db that I retrieve data from multiple times. I have a
| bunch
| > of
| > | > > combo boxes that I bind datasets to and when the user selects the
| > data I
| > | > > retrieve data from the dataset linked to that combo box. Now my
| > | question
| > | > is
| > | > > it better to have mutliple dataset or when I retrieve each
dataset I
| > | just
| > | > > add that dataset to one major dataset so when it is time to
retieve
| > the
| > | > data
| > | > > I just have one dataset to look up data? My concerns are
| performance
| > as
| > | > > well.
| > | > >
| > | > > Thanks
| > | > >
| > | > >
| > | >
| > | >
| > |
| > |
| > |
| >
|
|
|
 
I re-clarify my previous reply:

If there are many combo box controls, it is recommend keeping one dateset,
that make it easier to manager. Otherwise, you could use one dataeaset for
each combo, that make the code simpler.

Sincerely,

Kevin
Microsoft Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Get Secure! - www.microsoft.com/security

--------------------
| Newsgroups: microsoft.public.dotnet.framework.adonet
| From: (e-mail address removed) (Kevin Sun [MS])
| Organization: Microsoft
| Date: Mon, 20 Oct 2003 01:58:05 GMT
| Subject: Re: DataSet
| X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
|
| Hi,
|
| In this case, it is better to have a dataset for each combo box. It is
| easier for you to manager the data and it also uses less resource.
|
|
| Sincerely,
|
| Kevin
| Microsoft Support
|
| This posting is provided "AS IS" with no warranties, and confers no
rights.
| Get Secure! - www.microsoft.com/security
|
| --------------------
| | From: "Eric" <[email protected]>
| | References: <uxG#[email protected]>
| <[email protected]>
| <[email protected]>
| <[email protected]>
| | Subject: Re: DataSet
| | Date: Fri, 17 Oct 2003 09:26:34 -0600
| | Lines: 140
| | X-Priority: 3
| | X-MSMail-Priority: Normal
| | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| | X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| | Message-ID: <#[email protected]>
| | Newsgroups: microsoft.public.dotnet.framework.adonet
| | NNTP-Posting-Host: 64.207.45.37
| | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| | Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.adonet:63888
| | X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| |
| | Thanks for the reply. Merging datasets also work and my real question
is
| it
| | better (design/performance) to have a dataset for each combo box or
have
| one
| | for everything?
| |
| | Thanks
| |
| | | | > You could create multiple DataAdapter object based on different data
| | > source, and add the DataTables into a same DataSet by calling
| | > DataAdapter.Fill method. In this way, multiple combobox controls can
| based
| | > on the DataTables in a same DataSet. It works fine on my side. For
| | example:
| | >
| | > =============
| | > Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
| | > System.EventArgs) Handles MyBase.Load
| | >
| | > '''''DataTable1
| | > SqlDataAdapter1.Fill(DataSet1, "Table1")
| | >
| | > ComboBox1.DataSource = DataTable1
| | > ComboBox1.DisplayMember = "Customer"
| | > ComboBox1.ValueMember = "CustomerID"
| | >
| | > '''''DataTable2
| | > Dim DataTable2 As New System.Data.DataTable
| | > DataSet2.Tables.Add(DataTable2)
| | > DataTable2.TableName = "Employee"
| | >
| | > SqlDataAdapter2.Fill(DataSet2, "Employee")
| | >
| | > ComboBox2.DataSource = DataTable2
| | > ComboBox2.ValueMember = "EmployeeID"
| | >
| | > ''''''DataTable3
| | > Dim DataTable3 As New System.Data.DataTable
| | > DataSet1.Tables.Add(DataTable3)
| | > DataTable3.TableName = "Employee"
| | >
| | > SqlDataAdapter2.Fill(DataSet1, "Employee")
| | >
| | > ComboBox3.DataSource = DataTable3
| | > ComboBox3.ValueMember = "EmployeeID"
| | >
| | >
| | > End Sub
| | > ==================
| | >
| | >
| | >
| | > Sincerely,
| | >
| | > Kevin
| | > Microsoft Support
| | >
| | > This posting is provided "AS IS" with no warranties, and confers no
| | rights.
| | > Get Secure! - www.microsoft.com/security
| | >
| | > --------------------
| | > | From: "Tim" <[email protected]>
| | > | References: <uxG#[email protected]>
| | > <[email protected]>
| | > | Subject: Re: DataSet
| | > | Date: Thu, 16 Oct 2003 14:57:44 -0600
| | > | Lines: 42
| | > | X-Priority: 3
| | > | X-MSMail-Priority: Normal
| | > | X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
| | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
| | > | Message-ID: <[email protected]>
| | > | Newsgroups: microsoft.public.dotnet.framework.adonet
| | > | NNTP-Posting-Host: 64.207.45.37
| | > | Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
| | > | Xref: cpmsftngxa06.phx.gbl
| | microsoft.public.dotnet.framework.adonet:63810
| | > | X-Tomcat-NG: microsoft.public.dotnet.framework.adonet
| | > |
| | > | Thanks for your response. I think my question was a bit confusing.
| | What
| | > I
| | > | want to know is better to have one dataset then having multiple
| datsets.
| | > | What I mean by this is:
| | > |
| | > | I have combo boxes that will be binded to datasets based on user
| input.
| | > | After I bind them I use the datsets for data after the user selects
an
| | > item
| | > | in the combobox. Initially I saved each dataset however I was
| thinking
| | it
| | > | could create a base dataset and just merge each dataset to it and
then
| | > query
| | > | to get the results I need. I was wondering if this is a better
| approach
| | > and
| | > | is it performance wise better?
| | > |
| | > | Thanks
| | > |
| | > | | | > | > Are you referring to lookup data that is used to populate your
| | > comboboxes?
| | > | > If yes, we do all this up front on a seperate thread and then
cache
| | the
| | > | > lookup DataSet. We then bind to whatever lookup Datatable we
need
| in
| | > this
| | > | > Lookup Dataset.
| | > | >
| | > | >
| | > | > | | > | > > I have a db that I retrieve data from multiple times. I have a
| | bunch
| | > of
| | > | > > combo boxes that I bind datasets to and when the user selects
the
| | > data I
| | > | > > retrieve data from the dataset linked to that combo box. Now my
| | > | question
| | > | > is
| | > | > > it better to have mutliple dataset or when I retrieve each
| dataset I
| | > | just
| | > | > > add that dataset to one major dataset so when it is time to
| retieve
| | > the
| | > | > data
| | > | > > I just have one dataset to look up data? My concerns are
| | performance
| | > as
| | > | > > well.
| | > | > >
| | > | > > Thanks
| | > | > >
| | > | > >
| | > | >
| | > | >
| | > |
| | > |
| | > |
| | >
| |
| |
| |
|
 
Back
Top