Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Synchronizing datatable with the changes in the database
Message
De
16/07/2006 09:51:33
 
Information générale
Forum:
ASP.NET
Catégorie:
ADO.NET
Divers
Thread ID:
01136752
Message ID:
01136770
Vues:
11
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform