PC Review


Reply
Thread Tools Rate Thread

DataSet versus DataTable

 
 
tim
Guest
Posts: n/a
 
      17th Mar 2004
Hi,

I recently created a generic data access layer so I can use it in many
applications. It is designed to return datasets, datareaders, scalar
values... I recently have come across in an application that uses the data
access layer needing a datatable instead of a dataset. What I have been
doing is returning the dataset with only one datatable and then accessing
the datatable in code (ds.tables[0]). I have been thinking about changing
my data access layer to return datatables. However with that said, is it
worth the redesign? Will I see better performance? Do you think it is a
bad practice to fill a dataset with only one table?

Thanks


 
Reply With Quote
 
 
 
 
William Ryan eMVP
Guest
Posts: n/a
 
      18th Mar 2004
A dataset is a fancy collection of datatables. However, if you only have
one table, why create the collection if you don't have to? It's easier to
reference the table directly and makes the code more clear. I'd add it
personally, but it's probably not going to be a life or death difference.

HTH,

Bill
"tim" <(E-Mail Removed)> wrote in message
news:uu%(E-Mail Removed)...
> Hi,
>
> I recently created a generic data access layer so I can use it in many
> applications. It is designed to return datasets, datareaders, scalar
> values... I recently have come across in an application that uses the

data
> access layer needing a datatable instead of a dataset. What I have been
> doing is returning the dataset with only one datatable and then accessing
> the datatable in code (ds.tables[0]). I have been thinking about changing
> my data access layer to return datatables. However with that said, is it
> worth the redesign? Will I see better performance? Do you think it is a
> bad practice to fill a dataset with only one table?
>
> Thanks
>
>



 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      18th Mar 2004
Hi Tim,

Just to give another idea about that than Bill.

When you using a datatset or a datatable, the only thing you tranport in
your program is the reference. And therefore I would keep it for the one
type of the design and only use that dataset. Than you can everything also
with the datatable as by instance write it to XML while if you take the
other approach you have to add again special things.

Cor


 
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
How to fix A DataTable named 'Tag2' already belongs to this DataSet.(XML/Datatable) frodenekkoy@hotmail.com Microsoft Dot NET 0 8th Jul 2008 08:14 AM
Copying records from datatable to datatable in dataset tshad Microsoft C# .NET 1 24th Jun 2008 01:39 AM
DataTable versus DataSet mark-seattle Microsoft ADO .NET 0 7th May 2008 02:24 AM
DataSet versus DataTable tim Microsoft ADO .NET 2 18th Mar 2004 10:04 AM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N Microsoft ASP .NET 2 31st Oct 2003 02:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:13 PM.