PC Review


Reply
Thread Tools Rate Thread

DataAdapter newbie question

 
 
J L
Guest
Posts: n/a
 
      16th Feb 2005
I have two questions regarding the use of DataAdapters:

1. If I am going to retrieve multiple tales to a DataSet using
multiple DataAdapter Fill's is it best to create a separate
DataAdapter for each table or to create one and change it's
SelectCommand property between each Fill?

2. Related to number 1, is it best to explicitly open the connection
before the series of Fill's and close after rather than allow each
DataAdapter to implicitly open and close the connection.

TIA,
John

 
Reply With Quote
 
 
 
 
geeksgk@yahoo.com
Guest
Posts: n/a
 
      16th Feb 2005
Use separate dataadapter for each table. This way the run time
performance of your code will be faster when compared with reusing the
dataadapter sequentially.

You are right on the second one. use only one connection and close it
when the job is done or errors out (close it in the finally block).
This way, you can also implement transactions easily

 
Reply With Quote
 
Flip
Guest
Posts: n/a
 
      16th Feb 2005
> when the job is done or errors out (close it in the finally block).
I've read that you can use a using{ //block of code } and it will
automatically run the dispose methods (is that correct?). Can I use this
pattern instead of putting in try{}catch{}finally{} blocks?

I'm a newbie just getting into ADO, so if I've confused you, please help
straighten me out (gently :>) as I am looking to learn.

Thanks!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C3 Newbie DataAdapter question =?Utf-8?B?QWxsZW5kZQ==?= Microsoft C# .NET 8 8th Aug 2006 08:34 PM
Newbie question about dataadapter parameter Alphonse Microsoft ADO .NET 6 29th Jul 2005 03:55 AM
Problem with a DataAdapter - Newbie Question =?Utf-8?B?SmFuZSBLLg==?= Microsoft C# .NET 2 4th Feb 2004 10:58 PM
Problem with a DataAdapter - Newbie Question =?Utf-8?B?SmFuZSBLLg==?= Microsoft ADO .NET 1 4th Feb 2004 03:52 AM
Problem with a DataAdapter - Newbie Question =?Utf-8?B?SmFuZSBLLg==?= Microsoft Dot NET Framework Forms 0 4th Feb 2004 02:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:29 AM.