A general answer - I am sure you will get more detailed ones as well.
I like to use WHERE clauses in my SQL. As a matter of fact, I love it.
I try to retrieve only the data that is currently relevant to the task at hand.
When I am done with it, I clear my datasets.
How is this accomplished? Look into creating parameter queries.
You will have access to the parameters collection of your select
query through your dataadapter. You basically set the parameters
before executing the query. Then, only the data you need is retrieved.
You can allow a user to edit the data in the dataset and when you are
ready, post the changes back to the database using the hand update/insert/
delete queries stored in the dataadapter.
It is almost always better to retrieve as little data as needed.
Loosely coupled systems with disconnected data sources are
only one way to approach your project. It is usually the correct way.
There may be critical need for direct access to the data with locking
etc.
Also, remember, you don't have to create relationships in your
dataset. You can just use it to store the schema/data for your project
and work with the individual tables. Sometimes you need to create
the relationships. Crystal report projects with master/detail type
reports for instance. In other cases, you can just use one dataset
to store a bunch of disconnected data. You can easiy create
additional elements in your datatable schema and then bind controls
to this "hybrid" dataset.
GL - hope some of this made sense.
"Dave" <Da**@discussions.microsoft.com> wrote in message
news:FC**********************************@microsof t.com...
(My apologies for posting this on two forums. I have just found out the other
one was the incorrect location)
I am writing a VB.NET 2003 web application to operate on my company's
intranet. It accesses data in an SQL Server database. I have developed a
couple of pages that display data successfully. However, there is one area
that I am having trouble getting a handle on, despite purchasing a couple of
Wrox books.
Up until now, I have used a whole lot of data adapters and datasets to be
able to display my information. The data is stored in a very hierarchical
structured database. I now want to be able to edit, delete and add new
records to most of these tables. The data would be edited in datagrids.
I have seen some information that indicates that having a 'mirror-image' of
the original database stored in a dataset is the way to go, ie this is
retrieved from the database, then modified and then sent back.
My questions are:
Is it best to have a single large dataset mimicking the tables and table
structure in the database?
If so, how is this achieved effectively? I only seem to be able to bring
across a table at a time.
Any help would be greatly appreciated.
Dave.