PC Review


Reply
Thread Tools Rate Thread

DataSet Access

 
 
Kent Barnes
Guest
Posts: n/a
 
      8th Mar 2004
I have an application with multiple forms. I am trying to determine the
best way to share data between the various forms. I have experimented with
DataSets and have noticed that if use a dataset in one form (lets call it
form1) and update the data in form1 and then call form2 the data that is in
the form in form2 is the original data. The update does NOT appear to be
present?

kjbarnes(at)businessgoals(dot)com


 
Reply With Quote
 
 
 
 
Ginny Caughey [MVP]
Guest
Posts: n/a
 
      8th Mar 2004
Kent,

How are you sharing the DataSet across forms? It sounds like you have
multiple DataSets rather than multiple references to the same single
DataSet. If that's not the case, perhaps you're really updating the GUI and
not the underlying DataSet?
--
Ginny Caughey
..Net Compact Framework MVP

"Kent Barnes" <(E-Mail Removed)> wrote in message
newsr33c.172378$(E-Mail Removed)...
> I have an application with multiple forms. I am trying to determine the
> best way to share data between the various forms. I have experimented

with
> DataSets and have noticed that if use a dataset in one form (lets call it
> form1) and update the data in form1 and then call form2 the data that is

in
> the form in form2 is the original data. The update does NOT appear to be
> present?
>
> kjbarnes(at)businessgoals(dot)com
>
>



 
Reply With Quote
 
William Ryan eMVP
Guest
Posts: n/a
 
      8th Mar 2004
Kent:

I do this all of the time and have never had the problem you mention. The
first thing I'd wonder is how are you sure the changes aren't reflected?
Are you going by the GUI or have you set breakpoints and checked the
dataset? IF you filled a listbox for instance with a dataset during
Form_Load of your second form, then minimize it, make changes to the dataset
from Form1, whatever initialization code was in Form2 won't fire again just
by showing it so it may be that the dataset has actually reflected the
changes, it's just that the UI hasn't been refreshed so it doesn't appear
that way. I guess it depends on how you are loading and unloading your
forms. I can't tell from your post if Form2 is loaded already when you make
the update in form1 or not but it's somethign to look into.

Next, where are you storing the dataset so that all of the forms are
accessing it? Typically I'll create a singleton and have the dataset as a
property in that class. Then I reference can reference it from anywhere.

Verify that you are working with the same instance of the same dataset and
put a breakpoint in Form_Load (if you haven't loaded Form2 before making the
changes in Form1) or in Maximize...next, after you make your update in
form1, check the DataSet.Tables[IndexOrName].Rows.Count. When you hit your
breakpoint in Form2, verify the number. If it's a UI thing, the numbers
will agree although visually it may not look that way. If they don't agree,
then either you are referencing a different dataset or some other code is
making some changes.

HTH,

Bill
"Kent Barnes" <(E-Mail Removed)> wrote in message
newsr33c.172378$(E-Mail Removed)...
> I have an application with multiple forms. I am trying to determine the
> best way to share data between the various forms. I have experimented

with
> DataSets and have noticed that if use a dataset in one form (lets call it
> form1) and update the data in form1 and then call form2 the data that is

in
> the form in form2 is the original data. The update does NOT appear to be
> present?
>
> kjbarnes(at)businessgoals(dot)com
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dataset and MS Access CypherDrive Microsoft ADO .NET 3 31st Jul 2008 01:11 PM
DataSet en MS Access =?Utf-8?B?Rm9lZg==?= Microsoft ADO .NET 5 23rd Aug 2006 02:55 PM
How to access a dataset value? Shapper Microsoft ASP .NET 1 19th Jun 2005 03:53 AM
Dataset to Access DB T Cordon Microsoft ADO .NET 16 29th Apr 2004 03:50 AM
Dataset and MS Access Scott D. Barrish Microsoft ADO .NET 7 12th Feb 2004 02:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:55 AM.