user438975
user438975

Reputation: 263

OdbcDataAdapter Batch update not working

I am trying to perform a batch update in a .NET console application using OdbcDataAdapter by setting UpdateBatchSize:

 OdbcDataAdapter da = new OdbcDataAdapter();
 da.UpdateBatchSize = 100;

Trying to set UpdateBatchsize property throws following error:

set_UpdateBatchSize(Int32 value) Specified method is not supported.

If I set the UpdateBatchsize value to 1, then it works fine. Does OdbcDataAdapter support batch updates?

Here is msdn link to perform batch updates with DataAdapter

Any help would be greatly appreciated.

Upvotes: 0

Views: 390

Answers (1)

Gosha_Fighten
Gosha_Fighten

Reputation: 3868

Here is the decompiled code from the DbDataAdapter class:

public virtual int UpdateBatchSize
{
  get
  {
    return 1;
  }
  set
  {
    if (1 != value)
      throw ADP.NotSupported();
  }
}

The OdbcDataAdapter class does not override it. SqlDataAdapter does this. So, you may conclude that this feature is not supported in OdbcDataAdapter.

Upvotes: 3

Related Questions