dcsimg
Results 1 to 4 of 4

Thread: [RESOLVED] How many DataSets should I have?

  1. #1

    Thread Starter
    Fanatic Member schoemr's Avatar
    Join Date
    Apr 2016
    Location
    South Africa
    Posts
    828

    Resolved [RESOLVED] How many DataSets should I have?

    Hi, someone here on vbforums (JMC) once say me that if you have one database, then you must have one dataset. So by that time I already have maybe 20 datasets. E.g. If I create a report, I first create a dataset, then tableAdapter, then rdlc report, then report viewer. So I have ended up with a new dataset everytime I created a new report... But I have always keep this "one dataset for one database" word in my head... I would like to clarify that... I have watched some videos on youtube where Beth Massi creates a new dataset e.g. in this video:



    Is what she do here wrong then?
    Don't miss the whole point of the dance...

    https://www.youtube.com/watch?v=qHnIJeE3LAI

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    100,638

    Re: How many DataSets should I have?

    What I meant was that you should have just one DataSet class. It's just like when you add a form to your project. Let's say that you want to use a form to edit a Thing record. You might add a form named ThingDialogue. In that case, you are creating a class named ThingDialogue. There's just one class but, at run time, you can create as many instances of that class as you like. If the user wants to edit ten Thing records at the same time then you can create ten ThingDialogue objects.

    In the case of typed DataSets, the wizard generates a class. For instance, if you have a database named Stuff and you generate a typed DataSet with the wizard, you will get a StuffDataSet class. That is the one and only DataSet class you should have for that one database and, in the vast majority of cases, you should only have one database for the application. At run time, you can create as many instances of that StuffDataSet class as you need.
    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

  3. #3

    Thread Starter
    Fanatic Member schoemr's Avatar
    Join Date
    Apr 2016
    Location
    South Africa
    Posts
    828

    Re: How many DataSets should I have?

    Oh okay, I now understand... So I have many instances of the same dataset.. So in this video is not wrong to do like that..

    Thanks for clearing that up!
    Don't miss the whole point of the dance...

    https://www.youtube.com/watch?v=qHnIJeE3LAI

  4. #4
    PowerPoster
    Join Date
    Sep 2005
    Location
    Modesto, Ca.
    Posts
    3,848

    Re: How many DataSets should I have?

    Quote Originally Posted by schoemr View Post
    Oh okay, I now understand... So I have many instances of the same dataset.. So in this video is not wrong to do like that..

    Thanks for clearing that up!
    No, if your doing it like Beth Massi then your creating a new dataset class. What jmc is talking about is,
    Code:
    Dim ds as New StuffDataset
    I also watched the Massi videos when I was first learning .Net and she created multiple different datasets classes. I don't know that it's wrong to do it that way, when I first started in .Net most my projects had multiple datasets and they worked just fine. But I went to using only one dataset if possible because it just seemed more organized and easier to program having all the data in one place.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width