How does ADO.NET 2.0 DataAdapter do batch updates?

R

ronscottlangham

New feature in ADO.NET 2.0 is the ability to do batch updates using
the DataAdapter UpdateBatchSize property. From what I understand,
enhancements were added to the SQL Server and Oracle Data Providers to
support this. We have the need to support this directly without going
through the DataAdapter. Does anyone know how this is done
internally, or how this same feature can be used without relying on
the DataAdapter?

We are needing this for Oracle. Currently we are using the
System.Data.OracleClient. We may use ODP.NET and its parameter
arrays, which I am thinking is very similar in operation, but
currently our application is relying on ADO.NET
System.Data.OracleClient.
 
M

Miha Markic

I don't think batching mechanism is freely available.
But nevertheless, just construct all of your SQL statements in a single
string, asssign all parameters and fire away.
 
F

Frans Bouma [C# MVP]

New feature in ADO.NET 2.0 is the ability to do batch updates using
the DataAdapter UpdateBatchSize property. From what I understand,
enhancements were added to the SQL Server and Oracle Data Providers to
support this. We have the need to support this directly without going
through the DataAdapter. Does anyone know how this is done
internally, or how this same feature can be used without relying on
the DataAdapter?

We are needing this for Oracle. Currently we are using the
System.Data.OracleClient. We may use ODP.NET and its parameter
arrays, which I am thinking is very similar in operation, but
currently our application is relying on ADO.NET
System.Data.OracleClient.

It's as far as I know only available on the SqlDataAdapter, thus for
sqlserver. They batch statements with an internal routine. Yes, that's
right, not a public routine everyone would be able to use, but an
internal routine. They didn'tmake it public because the design then
would have to be different and there was no time (or so they said).

It's not a very big deal though. If you need it for oracle anyway, you
shouldn't be using MS' provider anyway. Indeed use array parameters as
that will save you way more.

You shouldn't have that much trouble migrating to ODP.NET as most of
the types are equally named (only the db type enum is named differently
and of course ODP.NET supports more types)

FB

--
------------------------------------------------------------------------
Lead developer of LLBLGen Pro, the productive O/R mapper for .NET
LLBLGen Pro website: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------
 
G

Guest

How would you then separate the multiple statements using the Microsoft
Oracle Managed Provider (System.Data.OracleClient)? Separting the statements
with semicolon failed. Is this provider capable of statement batching?
Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top