nedcomp hosting homepage

Producten en Diensten
Dedicated servers
Datacenter informatie
Partners, resellers
Helpdesk informatie
Technische docs, tools
Support homepage
ASP componenten
Praktische ASP, ASP.NET
Visual route server
Whois (domein gegevens)
Software documentatie
Whitepapers
Zoeken
Nedcomp / algemeen

Zoeken
 

Copyright © Nedcomp Hosting
Telefoon nr :   +31 184 670111
Fax nummer :   +31 184 631384
E-mailadres :   info@nedcomp.nl
 

.NET Framework Class Library  

DataSet.GetChanges Method

Gets a copy of the DataSet containing all changes made to it since it was last loaded, or since AcceptChanges was called.

Overload List

Gets a copy of the DataSet that contains all changes made to it since it was loaded or AcceptChanges was last called.

[Visual Basic] Overloads Public Function GetChanges() As DataSet
[C#] public DataSet GetChanges();
[C++] public: DataSet* GetChanges();
[JScript] public function GetChanges() : DataSet;

Gets a copy of the DataSet containing all changes made to it since it was last loaded, or since AcceptChanges was called, filtered by DataRowState.

[Visual Basic] Overloads Public Function GetChanges(DataRowState) As DataSet
[C#] public DataSet GetChanges(DataRowState);
[C++] public: DataSet* GetChanges(DataRowState);
[JScript] public function GetChanges(DataRowState) : DataSet;

Example

[Visual Basic, C#] The following example uses the GetChanges method to create a second DataSet object that is then used to update a data source.

[Visual Basic, C#] Note   This example shows how to use one of the overloaded versions of GetChanges. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
Private Sub UpdateDataSet(ByVal myDataSet As DataSet)
   ' Check for changes with the HasChanges method first.
   If Not myDataSet.HasChanges(DataRowState.Modified) Then Exit Sub
   ' Create temporary DataSet variable.
   Dim xDataSet As DataSet
   ' GetChanges for modified rows only.
   xDataSet = myDataSet.GetChanges(DataRowState.Modified)
   ' Check the DataSet for errors.
   If xDataSet.HasErrors Then
      ' Insert code to resolve errors.
   End If
   ' After fixing errors, update the data source with the DataAdapter 
   ' used to create the DataSet.
   myOleDbDataAdapter.Update(xDataSet)
End Sub

[C#] 
private void UpdateDataSet(DataSet myDataSet){
   // Check for changes with the HasChanges method first.
   if(!myDataSet.HasChanges(DataRowState.Modified)) return;
   // Create temporary DataSet variable.
   DataSet xDataSet;
   // GetChanges for modified rows only.
   xDataSet = myDataSet.GetChanges(DataRowState.Modified);
   // Check the DataSet for errors.
   if(xDataSet.HasErrors){
      // Insert code to resolve errors.
   }
   // After fixing errors, update the data source with the DataAdapter 
   // used to create the DataSet.
   myOleDbDataAdapter.Update(xDataSet);
}

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

DataSet Class | DataSet Members | System.Data Namespace