Results 1 to 4 of 4

Thread: [2.0] DataSet v Object storage

  1. #1

    Thread Starter
    Fanatic Member Bombdrop's Avatar
    Join Date
    Apr 2001
    Location
    St Helens, England, UK
    Posts
    667

    Question [2.0] DataSet v Object storage

    Recently had an interview and ask how I handled data from a DB, I said i just use a datareader to read the data into an object/Collectionwith fields mapped to the info downloaded, the interviewer looked as if i pi$$ed n his shoes and told me the only and best Way was via Datasets and Datatables When i tried to explain i found this method of data access a bit to procreative I could tell I wold not get the job. So just wondering how you guys go about it I know my method works but should i truly embrace the full features of ADO.Net ?

    Thanks!!

  2. #2
    Hyperactive Member The_Duck's Avatar
    Join Date
    May 2005
    Location
    Leamington, UK
    Posts
    351

    Re: [2.0] DataSet v Object storage

    I would really have to recommend you give datasets and datatables a try. Especially with the .net 2.0 stuff where you link your SQL statements into a tableadapter.

    Datasets do have a large overhead, in terms of memory and speed. However a dataset is more logically similar to the data you have stored in a database.

    Personally I nearly always use datasets. I would really recommend that you give them a go!

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2.0] DataSet v Object storage

    There are always multiple ways to divest a feline of it epidermis, and many often have merit. Using objects and strongly typed collections for data is of most use in a distributed system. Untyped DataSets are not ideal purely for the fact that they are untyped. Getting data from an untyped DataSet is like using late-binding or reflection. It is convenient but there's no help from the IDE and a single character out of place, which the IDE won't pick up, could cause your app to crash at run time. Strongly-typed DataSets don't have this issue and VS 2005 gives you lots of help to create them. Each DataRow from a strongly-typed DataSet already IS an object with appropriately named and typed properties corresponding to each column. Declaring your own types is simply reinventing the wheel. That doesn't mean that other methods are not valid, but there is no genuine reason that I can see that you shouldn't use strongly-typed DataSets. I guess the one major advantage of using your own types is that you can still give them other members that a strongly typed DataRow will not have.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: [2.0] DataSet v Object storage

    The answer is C - it depends. Just like any other tool, you use the right one for the right job. If you need to put a nail into a wall, you use a hammer, not a screwdriver. Conversly when dealing with screws, you use the screwdriver.

    The is no one right answer.... sometimes I find a dataset more convienient than collections and objects.... sometimes the other is true.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width