Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Synchronizing datatable with the changes in the database
Message
From
16/07/2006 09:51:33
 
General information
Forum:
ASP.NET
Category:
ADO.NET
Miscellaneous
Thread ID:
01136752
Message ID:
01136770
Views:
10
This message has been marked as a message which has helped to the initial question of the thread.
Hi Paolo,

You can use the System.Windows.Forms.Timer. Once you get data from your database, I think all you'll need to do is use the DataSet.Merge() method, something like this (off the top of my head and untested):
//Note that you need to set the PrimaryKey property of a DataTable in order to use Merge.

DataSet dsRefreshData = new DataSet();
MyDataAdapter.Fill(dsRefresh);
dsRefresh.Tables[0].PrimaryKey = new DataColumn[1] {dsRefresh.Tables[0].Columns["MyPKColumn"]};

// Assuming that the tables in dsMyData also have PrimaryKeys set
dsMyData.Merge(dsRefresh);
~~Bonnie

>Hi,
>
>On my main form i binded several textboxes to a datatable; what id like to do is every couple of minutes, or when the user clicks on a refresh button, i can pick up the changes in the database and merge it with my datatable.
>
>any suggestions?
>
>thanks,
>
>paolo
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform