DataSet or DataTable???

Hello My experienced VB friends,

What is the best way to code my application

Using the DataSet or the DataTable.

I mostly use 1 table.

Thank you guys,



Answer this question

DataSet or DataTable???

  • A.Russell

    Hello,

    Back in the old days, DataSet came with a bunch of methods that DataTable didn't have (ReadXml(), WriteXml(), Merge(), etc.). With .NET 2.0, the DataTable became just about as powerful as the DataSet and if you're only working with a single table, you should get along fine without the DataSet.

    I would use a DataTable until/if a reason pops up to use a DataSet. It will make your code that much simpler and that's a good thing.


  • bes7252

    RayV wrote:
    I would use a DataTable until/if a reason pops up to use a DataSet. It will make your code that much simpler and that's a good thing.

    Not necessarily. Two points to consider:

    1) DataSets contain DataTables, so it's not much trouble to obtain the latter from the former.
    2) The ADO.NET framework is designed to work seamlessly with DataSets -- not so much with DataTables.

    If your application absolutely positively never needs to deal with multiple data sources, you can probably get away with using a DataTable. Call me biased, but I can't imagine a situation where working directly with a DataTable -- as opposed to a DataSet which contains the same DataTable -- will save you much effort.



  • DataSet or DataTable???