Is a DataSet a RecordSet or a DB?

  • Thread starter Thread starter Daryll Shatz
  • Start date Start date
D

Daryll Shatz

I am getting confused. Is a dataset intended to be used as a recordset (ie:
ADO.Recordset) or a database?

I have 8 tables (varys from 100 to 10000 records in each table) which are
shared among many forms. Is the best design to create a single dataset
containing all the tables, populate all the tables in the main form, and
then create dataviews in each form to access/edit the records? Or is it
better to create "mini" datasets on each form that only contains the tables
needed by that form and load the tables everytime the form is invoked?

It would seem better (faster and less resources) to create a single dataset,
populate it, and then use the dataviews to access them.

How is this intended to be done?
 
Hi Daryll,

Daryll Shatz said:
I am getting confused. Is a dataset intended to be used as a recordset (ie:
ADO.Recordset) or a database?

No. The recordset was primarily designed to be connected, while the dataset
is never connected nor is dependend on database.
I have 8 tables (varys from 100 to 10000 records in each table) which are
shared among many forms. Is the best design to create a single dataset
containing all the tables, populate all the tables in the main form, and
then create dataviews in each form to access/edit the records? Or is it
better to create "mini" datasets on each form that only contains the tables
needed by that form and load the tables everytime the form is invoked?

It would seem better (faster and less resources) to create a single dataset,
populate it, and then use the dataviews to access them.

How is this intended to be done?

It is up to you, really.
I normally create datasets for a business procedure IOW dataset with tables
I need for a procudure (mini datasets in your words :) ).
So I have better control on what's going on.
Your approach will be a bit slow and memory demanding - imagine loading all
data from a 1Gb database.
I would really recommend against it.
 
Daryll,
In addition to Miha's comments.

A DataSet is an in memory collection of DataTables, A DataTable is very
similar to ADODB.Recordset, however it also is not a Recordset, as you need
to a DataAdapter to be used to get the IO.

If you don't have it, David Sceppa's book "Microsoft ADO.NET - Core
Reference" from MS Press is both a good tutorial on every thing ADO.NET and
a good desk reference.
I have 8 tables (varys from 100 to 10000 records in each table) which are
shared among many forms. Is the best design to create a single dataset
containing all the tables, populate all the tables in the main form, and
I would only populate the dataset with data I actually needed, not the
entire 10000 rows!
It would seem better (faster and less resources) to create a single dataset,
populate it, and then use the dataviews to access them.
When I use datasets, I prefer a single dataset with multiple tables, so I
can define the relationships between the tables as opposed to independent
datasets each with a single datatable in it.

Also As Miha suggests, I would only populate individual tables in the shared
dataset with data, as I need that data. As I mentioned above, I would then
only populate rows with the rows I need.

Hope this helps
Jay
 
Daryll

I have a the same confusion as you a while ago, I understand what dataset is
and how different it is from a recordset,
for a dataset, you can basically call it a mini database in the memory in
the client machine. but in some case, I am still
not sure how to use it properly. using a dataset, you can load the records
that are needed to be managed, but in many cases,
a user only need to edit one record at a time, so I don't see anything wrong
with the recordset model, but he shortcoming with
the recordset is a program need to keep track of the changes of the data.

In one of my projects I work on a project information management system, a
user will work on one project at a time in a MDI
system, so there is not need and it's not efficient to load a whole bunch of
projects in to a dataset just to get one project, what I
do is load all project code and title in to a dropdownlist and after the
user pick a project, then the program will fetch the corresponding
project into the winform. but then the program need to keep track of all
changes on the project info (if you want to do it efficiently) and construct
a sql statement to update the record when user press the save button or pick
another project. with a dataset, one can bind all it's columns in
a table into controls in a winform and there are three copies of each record
in the dataset, so the dataset will keep track of all changes and the
dataadapter update method will update all changed records. so the only
efficient model I can think of in this case is to use dataset to hold one
record and bind all its columns to the controls in a winform. now this is
not the way a dataset supposed to function, but heck, I think it's more
efficient this way and it's more concurrent than the disconnected
model.(binding a whole bunch of records in a dataset into a winform then
navigating through the records using bindingcontext and update the dataset
when the user is done.) in a multiuser settiing.

don't know if anyone can give me a better model when dealing with this kind
of system, but if you do, please let me know.
 
Dear Miha,

Daryll Shatz passed away this week. I am his boss. Are you able to
tell if Daryll purchased product from this website. I want to ensure
that his family is re-imbursed. Is this website a forum or eStore or
both?

Thanks,
David Beck
94-754-8310
 
Dear Jay,

Daryll Shatz passed away this week. I am his boss. Are you able to
tell me if Daryll recently purchased product from this website. I want
to ensure that his family is re-imbursed. Is this website a forum or
eStore or both?

Thanks,
David Beck
94-754-8310
 
Dear Kevin,

Daryll Shatz passed away this week. I am his boss. Are you able to
tell if Daryll purchased product from this website. I want to ensure
that his family is re-imbursed. Is this website a forum or eStore or
both?

Thanks,
David Beck
949-754-8310
 
Hi David,

Sorry to hear that.
These are Microsoft's public newsgroups, so he couldn't purchase anything
from here.
 
Back
Top