Writing data provider indepedent code  
Author Message
cmaclo





PostPosted: .NET Framework Data Access and Storage, Writing data provider indepedent code Top

I have developed an application that has to connect to multiple databases (mysql, SQL server etc) The functionality that .net provides has been really useful for this ie. using Dbcommand with providerFactory instead of explicitly using SqlCommand/OdbcCommand... I am having a few issues though.

Firstly I had to create my own custom DbDataAdapter since using the base class did not give me access to event handlers like 'RowUpdatingEventHandler'. I read a good explanation of this short-fall on this web page:

http://www.hide-link.com/

The second issue im having now which i can not find a solution for, is the batch updating functionality. Originally i was using the commands

myOdbcDataAdapter.UpdateBatchsize = max;

myOdbcDataAdapter.Update()

...since i changed my code to use a generic DbDataAdapter with providerFactory.CreateDataAdapter() or my custom DbDataAdapter i am unable to use the 'UpdateBatchsize' property. This property only works if you're explicitly using a provider, for instance SqlDataAdapter.UpdateBatchsize works fine.

All other functionality seems to work fine using the base classes. This UpdateBatchsize property is my only issue (i hope!)

Can anyone shine some light on this for me

Thanks




.NET Development31  
 
 
Bill Lin - MSFT





PostPosted: .NET Framework Data Access and Storage, Writing data provider indepedent code Top

In ADO.NET 2.0, DbDataAdapter does have the property UpdateBatchsize. However, it's only supported for SqlClient and OracleClient.

 
 
cmaclo





PostPosted: .NET Framework Data Access and Storage, Writing data provider indepedent code Top

Thanks.

Of all the documentation I read I never came across that point.