J
John Kotuby
Hi all,
I was reading a post regarding questions about how to properly separate the
Presentation layer from the BLL and the DAL (I don't know the acronym for
the presentation layer). Quite an interesting discussion it was. I started
to set up my ASP.NET 2.0 VB Web Application that way and then got bogged
down in details about SqlDataSource and strongly typed datasets. The project
involved the conversion of a very large existing application from ASP to
ASP.NET. Most of the Data Access code was written in ADO and very up-front,
as in built in directly with the presention layer. The ASP app was written
by another coder, long gone. I had to study and learn what was going on in a
relatively short time frame so I just dove in and started coding.
I have managed to separate the Data code from the Presentation code in a
very minimal way so far. My preference is to use disconnected DataSets and
DataTables with the SqlConnection and SqlDataAdapter. This is a preference
derived from 6 years of coding in VB6 and SQL 2000 on another (still-active)
large production application which also uses ADO and disconnected
RecordSets.
So far my Data Access 'separation' just involves running the SQL code in the
Code Behind and then using the results of the queries in the form of
DataTables. Below is an example of the beginning of a typical
"GetRecordSets" Method. Note that there are numerous tables populated. I
prefer to run all the queries in one swoop during Page Load.
Protected Sub GetRecordSets()
Dim MyConnection As New SqlConnection
Dim MyCommand As New SqlCommand
Dim MyAdapter As New SqlDataAdapter
Dim CardTable As New DataTable()
Dim SummaryTable As New DataTable()
Dim DeckTable As New DataTable()
Dim UsageTable As New DataTable()
Dim SegTable As New DataTable()
Dim CatTable As New DataTable()
Dim SelTable As New DataTable()
Dim ContactTable As New DataTable
I dispose of these objects at the end of each GetRecordSets() Method.
Now I am beginning to see the patterns of repetition and would like to start
moving most of this code to the DAL.
Is there a good tutorial or article that describes using the DAL with the
components I prefer to work with? Each of these tables require a separate
query. I can probably gang up all the queries in a single monstor SQL 2005
Stored Procedure and then pull the individual Table information from a
returned DataSet.
Thanks for any help.
I was reading a post regarding questions about how to properly separate the
Presentation layer from the BLL and the DAL (I don't know the acronym for
the presentation layer). Quite an interesting discussion it was. I started
to set up my ASP.NET 2.0 VB Web Application that way and then got bogged
down in details about SqlDataSource and strongly typed datasets. The project
involved the conversion of a very large existing application from ASP to
ASP.NET. Most of the Data Access code was written in ADO and very up-front,
as in built in directly with the presention layer. The ASP app was written
by another coder, long gone. I had to study and learn what was going on in a
relatively short time frame so I just dove in and started coding.
I have managed to separate the Data code from the Presentation code in a
very minimal way so far. My preference is to use disconnected DataSets and
DataTables with the SqlConnection and SqlDataAdapter. This is a preference
derived from 6 years of coding in VB6 and SQL 2000 on another (still-active)
large production application which also uses ADO and disconnected
RecordSets.
So far my Data Access 'separation' just involves running the SQL code in the
Code Behind and then using the results of the queries in the form of
DataTables. Below is an example of the beginning of a typical
"GetRecordSets" Method. Note that there are numerous tables populated. I
prefer to run all the queries in one swoop during Page Load.
Protected Sub GetRecordSets()
Dim MyConnection As New SqlConnection
Dim MyCommand As New SqlCommand
Dim MyAdapter As New SqlDataAdapter
Dim CardTable As New DataTable()
Dim SummaryTable As New DataTable()
Dim DeckTable As New DataTable()
Dim UsageTable As New DataTable()
Dim SegTable As New DataTable()
Dim CatTable As New DataTable()
Dim SelTable As New DataTable()
Dim ContactTable As New DataTable
I dispose of these objects at the end of each GetRecordSets() Method.
Now I am beginning to see the patterns of repetition and would like to start
moving most of this code to the DAL.
Is there a good tutorial or article that describes using the DAL with the
components I prefer to work with? Each of these tables require a separate
query. I can probably gang up all the queries in a single monstor SQL 2005
Stored Procedure and then pull the individual Table information from a
returned DataSet.
Thanks for any help.