Share Dataset across multiple windows form

  • Thread starter Thread starter Goh
  • Start date Start date
G

Goh

Hi,
Got question every time windows from is load database, are dataset
is isolated with others form? if this is true then it mike take up allot of
memory space.

Can we actually share the same dataset across multiple windows form
to prevent every fill data from database.

How can we share a dataset and datasource across multiple forms.

Do you guy can show me some sample how to work with this?


Thanks in advance,
Have a nice days.
Goh
 
In winforms they are isolated to the specific application. YOu can make a
shared property out of one /or static property and share it between forms in
the app but each app will get a separate version. If you need the data,
there's not much way around it whehter you use custom business objects or
anything else.
 
Hi Goh,

I agree. When data is loaded to the form depends on how your app is
designed. You can try to make a static properties of class as a data source
and bind two forms to this source.

You can also fill this DataSet only when needed by checking if DataSet
reference is null.

//initially difine ds as a null reference
if(ds == null)
{
dataAdapter.Fill(ds);
}
return ds;

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.)
 
Back
Top