UpdateBatchSize

  • Thread starter Thread starter Juan Ignacio Gelos
  • Start date Start date
J

Juan Ignacio Gelos

Hi,

In .NET 2, is there any way to batch multiple DataSet updates like the
ones that occur on a windows form editing a parent and a child table? This
means at least 4 calls to TableAdapter.Update plus multiple round trips to
the server while the TableAdapter traverses each row and
updates/adds/deletes it.

Thanks,
Juan
 
In .NET 2.0 you can set a BatchSize property to > 1 that instructs ADO.NET
to combine several commands in a single batch. This way the server makes
several changes in a single round trip. This assumes you're not using a
simplistic DBMS like JET that supports scripted SQL.
You still might have to make several calls to the Update method to sequence
the changes in the right order (delete children first, add, change and
delete parents and then add children). You should be able to get away with
doing two Updates to get this done for each Parent/Child pair of tables.

--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
 
My question was directed at using standard strongly-typed datasets, which
use TableAdapters (not DataAdapters), and hence there's no way to set the
UpdateBatchSize property other than mangling the autogenerated source code
by changing the (internal) DataAdapters initialization code. I was hoping
there was some kind of component that allowed to pre-cache SQL statements
from multiple TableAdapters and send them all at once.
You can't get away with two Updates for each Parent/child parents. Take a
look at the following help topic for an explanation.
ms-help://MS.VSCC.v80/MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/d
v_raddata/html/7ebe03da-ce8c-4cbc-bac0-a2fde4ae4d07.htm
 
Back
Top