working with tableadapters and classes RRS feed

  • Question

  • User-1155760005 posted

    I'm working with tableadapters to access strongly typed datasets in web application.  The datasets are stored in a folder inside of the project.  I don't want to access the tableadapters directly from the presentation code behind so I decided to a class to provide a layer of abstraction.   I now have web pages for the presention, a class for the business layer, and the datasets for the data access layer.  I'm trying to figure out the best way to pass the information that is retrieved from the datasets to the presentation.   I'm not sure if I should create functions in the class that returns a dataset/datatable to the presentation?  Or should I create class properties and assign the dataset/datatable row values to each property and return the class itself?  Can someone explain the correct way to return tableadapter data in the modified 3 tier approach mentioned above? 

    Public Function GetData(ByVal Name as string) as DataSet

       ' Table adapter call

         return DataSet

    End Function

    Public Property Address as String

    Public Function GetData(ByVal Name as string) as ClassName

       ' Table adapter call

       If UserDatatable.row.count > 0

       ClassName.Address = UserDatatable.Address

       End if

         return ClassName

    End Function

    Monday, August 18, 2014 10:00 PM