System.Data.Common.DbDataAdapter.Update C# (CSharp) Method

Update() public method

public Update ( DataSet dataSet ) : int
dataSet System.Data.DataSet
return int
        public override int Update(DataSet dataSet)
        {
            return Update(dataSet, DbDataAdapter.DefaultSourceTableName);
        }

Same methods

DbDataAdapter::Update ( DataRow dataRows ) : int
DbDataAdapter::Update ( DataRow dataRows, DataTableMapping tableMapping ) : int
DbDataAdapter::Update ( DataSet dataSet, string srcTable ) : int
DbDataAdapter::Update ( DataTable dataTable ) : int

Usage Example

Beispiel #1
0
 /// <summary>
 /// Calls the respective insert, update or delete command
 /// for each object in the specified collection to save the entity to the database.
 /// </summary>
 /// <param name="transaction">The transaction to save within.</param>
 /// <param name="entities">The entities to save.</param>
 /// <param name="batchSize">A value that enables or disables batch processing support, and specifies the number of commands that can be executed in a batch.
 /// <para>When the value is 0, the default, the adapter will use the largest batch size the server can handle.</para>
 /// <para>When the value is 1 batching is disabled.</para>
 /// <para>A value > 1 will send changes to the database using the specified batch size.</para></param>
 public virtual void Save(Transaction transaction, ICollection <T> entities, int batchSize = 0)
 {
     _batchSize = batchSize;
     if (_batchSize != 1)
     {
         InitializeDataAdapter(transaction);
         DataTable changes = CreateDataTable(entities);
         _dataAdapter.Update(changes);
         if (BatchComplete != null)
         {
             BatchComplete(this, new BatchCompleteEventArgs <T>(entities, changes.Rows));
         }
     }
     else
     {
         foreach (T entity in entities)
         {
             Save(transaction, entity);
         }
     }
 }
All Usage Examples Of System.Data.Common.DbDataAdapter::Update