+ Reply to Thread
Results 1 to 9 of 9

Thread: one or more dataset in one application

  1. #1
    ghassan_aljabiri's Avatar
    ghassan_aljabiri is offline VB.NET Forum Newbie ghassan_aljabiri is on a distinguished programming path ahead
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Mar 2009
    Age
    31
    Posts
    23
    Reputation
    19

    Default one or more dataset in one application

    this is the situation

    an application has a main form with many button

    a button calls a dialog that is used to add to the database
    a button calls a dialog that is used to delete from the database
    a button calls a dialog that is used to search and so on

    i use many datasets (one per form)

    is it the right way , or is it prefered to use one dataset as global and let all the forms deal with it?
    Hey , You Need Me

  2. #2
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Age
    41
    Posts
    6,736
    Reputation
    653

    Default

    If you're creating DataSets in forms then yes, creating multiple DataSets in multiple forms is appropriate. It really depends on the specifics of each form as to whether that form requires its own DataSet or it should get data from another form.

    As you get more experienced you'll find that it's preferred not to create DataSets in forms at all. The most professional way to build software is with a dedicated data access layer. That data access layer can be constructed in various ways but it handles all the database access and then other components in your application request data from it.

  3. #3
    ghassan_aljabiri's Avatar
    ghassan_aljabiri is offline VB.NET Forum Newbie ghassan_aljabiri is on a distinguished programming path ahead
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Mar 2009
    Age
    31
    Posts
    23
    Reputation
    19

    Default where could i find a good reference?

    hello where could i find a good reference?
    Hey , You Need Me

  4. #4
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Age
    41
    Posts
    6,736
    Reputation
    653

    Default

    Quote Originally Posted by ghassan_aljabiri View Post
    hello where could i find a good reference?
    For what exactly?

  5. #5
    cjard's Avatar
    cjard is offline VB.NET Forum All-Mighty cjard has a reputation beyond repute cjard has a reputation beyond repute cjard has a reputation beyond repute cjard has a reputation beyond repute cjard has a reputation beyond repute cjard has a reputation beyond repute cjard has a reputation beyond repute cjard has a reputation beyond repute cjard has a reputation beyond repute cjard has a reputation beyond repute cjard has a reputation beyond repute
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Apr 2006
    Age
    66
    Posts
    6,676
    Reputation
    927

    Default

    Quote Originally Posted by jmcilhinney View Post
    As you get more experienced you'll find that it's preferred not to create DataSets in forms at all.
    Can you expand on this a little? I'd have advocated that a strongly typed DataSet, and all its associated TableAdapter/DataTable/DataRelation paraphernalia IS a good abstracted data layer for an application.

    By contrast, if by "creating datasets in forms " you mean that button click handler code literally contains: Dim ds as New DataSet: ds.Tables.Add(New DataTable): ds.Tables(0).Columns.Add(...)
    then yes, I'd agree that it's "bad"


  6. #6
    ghassan_aljabiri's Avatar
    ghassan_aljabiri is offline VB.NET Forum Newbie ghassan_aljabiri is on a distinguished programming path ahead
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Mar 2009
    Age
    31
    Posts
    23
    Reputation
    19

    Default

    I asked for a reference on how to construct the dedicated data access layer

    but i want to ask cjard the same question , is it prefered to use one global dataset or use many datasets (one per form)
    Hey , You Need Me

  7. #7
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Age
    41
    Posts
    6,736
    Reputation
    653

    Default

    Quote Originally Posted by cjard View Post
    Can you expand on this a little? I'd have advocated that a strongly typed DataSet, and all its associated TableAdapter/DataTable/DataRelation paraphernalia IS a good abstracted data layer for an application.

    By contrast, if by "creating datasets in forms " you mean that button click handler code literally contains: Dim ds as New DataSet: ds.Tables.Add(New DataTable): ds.Tables(0).Columns.Add(...)
    then yes, I'd agree that it's "bad"

    Dragging DataSets and TableAdapters onto forms is simple but violates separation of concerns. Using typed DataSets, DataTables and DataRows as your entity layer and TableAdapters in your DAL is fine, but data access in forms is obviously not when you start talking about serious applications. I know that you know this and were just asking for clarification of my position.

  8. #8
    ghassan_aljabiri's Avatar
    ghassan_aljabiri is offline VB.NET Forum Newbie ghassan_aljabiri is on a distinguished programming path ahead
    .NET Framework
    .NET 2.0 (VS 2005)
    Join Date
    Mar 2009
    Age
    31
    Posts
    23
    Reputation
    19

    Default

    How to create the DAL?
    Hey , You Need Me

  9. #9
    jmcilhinney's Avatar
    jmcilhinney is offline VB.NET Forum Moderator jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute jmcilhinney has a reputation beyond repute
    .NET Framework
    .NET 3.5 (VS 2008)
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Age
    41
    Posts
    6,736
    Reputation
    653

    Default

    Quote Originally Posted by ghassan_aljabiri View Post
    How to create the DAL?
    There's no one answer to that. You should do some reading a n-tier design and DALs specifically.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Tags for this Thread

Bookmarks

Posting Permissions

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