Efficient Filling Multiple DataTables

G

Guest

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.
 
M

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.
 
G

Guest

Thanks Miha. Both great ideas.
--
John


Miha Markic said:
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 said:
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.
 

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