DataSet Questions!

A

Adam Knight

Hi all,

A couple of quick questions relating to datasets:

Is one dataset in a given page generally used to bind all controls to db
data?

If a dataset object is to be used globally by all, is it best to use the
'New DataSet' declaration in PAGE_LOAD?

What is the lifetime of a dataset in a client server environment?

Does the dataset exist in memory over multiple page requests?

Where does the IF Not IsPostBack statement come in when using datasets?

Cheers
 
T

Tom.PesterDELETETHISSS

Hi Adam,

I'll try to anwser your questions but some are very general so expect general
answers.
Is one dataset in a given page generally used to bind all controls to
db data?

You have a choice.
Since a dataset is a collection of data and metadata (tables,relations,...
its actualy a mini database) you could use 1 super dataset that gets filled
up very early in the page life cycle (PAGE_LOAD for example).
The controls on the page could than refer to this god dataset.
This strategy may have some advantages but most code I see create ad hoc
datastructures and bind to them individualy.
What is the lifetime of a dataset in a client server environment?

Once a dataset/datatable is filled up it has no connection to the database
(its a disconnected view of the data) so it doesnt hold up resources. This
is a good property if you need it.

That dataset can be saved to a disk file for example, be seperated for 1
week of the database, receive updates/deletes/inserts and than gets send
back to the database.
You have to beware of updata conflicts and other issues when you take this
road.
This is an extreme case of course. You can make the dataset live for as long
as you want.
Does the dataset exist in memory over multiple page requests?

Not if you don't take extra steps. You have to pack it into a in a session
var/application var/cache/... to get this desired behaviour.
Where does the IF Not IsPostBack statement come in when using
datasets?

The are not directly related.
IsPostBack is related to the concept of viewstate which makes it possible
for visible gui elements to remember its contents between server round trips.
Do you have specific code that gives you problems?


Let me know if you have any more questions..

Cheers,
Tom Peste
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,274
Latest member
JessMcMast

Latest Threads

Top