Home All Groups Group Topic Archive Search About

Efficient Filling Multiple DataTables

Author
14 Jul 2006 7:30 PM
JT
Hi all,
I am transitioning from ADO.NET 1.1 to 2.0.  One of my 1.1 practices when
filling a dataset with several related datatables was to
explicitly open the connection,
call fill for each dataAdapter involved,
explicitly close the connection.
This saved the overhead of the connection opening and closing for every
dataAdapter.Fill.
In 2.0, if I fill via TableAdapters, this approach could get pretty
convoluted.  Is it worth pursuing?  Any known examples of an efficient
approach to this situation?
Thanks.

--
John

Author
14 Jul 2006 8:17 PM
Miha Markic [MVP C#]
You could specify many selects into a single dataadapter and map the results
to proper tables.
Or assign the same connection instance to all the tableadapters involved.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Show quote
"JT" <Jthayer@online.nospam> wrote in message
news:835853E5-0F79-4784-912C-17870B2490E0@microsoft.com...
> Hi all,
> I am transitioning from ADO.NET 1.1 to 2.0.  One of my 1.1 practices when
> filling a dataset with several related datatables was to
> explicitly open the connection,
> call fill for each dataAdapter involved,
> explicitly close the connection.
> This saved the overhead of the connection opening and closing for every
> dataAdapter.Fill.
> In 2.0, if I fill via TableAdapters, this approach could get pretty
> convoluted.  Is it worth pursuing?  Any known examples of an efficient
> approach to this situation?
> Thanks.
>
> --
> John
Author
14 Jul 2006 8:46 PM
JT
Thanks Miha.  Both great ideas.
--
John


Show quote
"Miha Markic [MVP C#]" wrote:

> You could specify many selects into a single dataadapter and map the results
> to proper tables.
> Or assign the same connection instance to all the tableadapters involved.
>
> --
> Miha Markic [MVP C#, INETA Country Leader for Slovenia]
> RightHand .NET consulting & development www.rthand.com
> Blog: http://cs.rthand.com/blogs/blog_with_righthand/
>
> "JT" <Jthayer@online.nospam> wrote in message
> news:835853E5-0F79-4784-912C-17870B2490E0@microsoft.com...
> > Hi all,
> > I am transitioning from ADO.NET 1.1 to 2.0.  One of my 1.1 practices when
> > filling a dataset with several related datatables was to
> > explicitly open the connection,
> > call fill for each dataAdapter involved,
> > explicitly close the connection.
> > This saved the overhead of the connection opening and closing for every
> > dataAdapter.Fill.
> > In 2.0, if I fill via TableAdapters, this approach could get pretty
> > convoluted.  Is it worth pursuing?  Any known examples of an efficient
> > approach to this situation?
> > Thanks.
> >
> > --
> > John
>
>
>

AddThis Social Bookmark Button