Be the first to write a review
Creating a Data Tier in ASP.NET
Every application starts with an idea, a thought or a need of some kind and the software of course becomes the solution. Once requirements have been gathered and the project vision is established the architects usually begin designing a logical framework for the application based on several factors.
It’s usually recommended no matter what the size or projected complexity of the application that there is some form of separation between interface logic, business rules and database logic. Creating this separation not only maintains a clean easier to read application but it also creates physically separate components which can then be reused in other areas or even deployed separately on other dedicated servers and invoked remotely.
A middle of the road approach is what most mid-sized applications will implement. Where most of the business logic will remain tied into the front end code and the database logic separated into another component and invoked as needed from the front end. This is still a 2-tier approach but it is definitely more favourable than having the database logic and SQL code embedded into the front end.
In this tutorial will we look at a fairly basic example of how to implement a database connection layer into an ASP.NET project which can then be invoked from your aspx pages in the code-behind. This style of approach bypasses all GUI wizards and connection/adapter controls which would normally be configured on the code-behind file. Instead we will push this logic into a separate component.
Note: Part 1 requires Visual Studio .NET running ASP.NET ver 1.1 and access to any version of SQL server. Both VB.NET and C# code samples will be provided
Important Note! This tutorial will ‘not’ demonstrate how to actually execute the database requests or link to a sample database. This tutorial provides the class required to create a proper database layer which you can then implement into your own applications on any SQL database of your choice. Reading samples tables or executing stored procedures for example are not demonstrated in this tutorial.
Kevin Koch
Kevin Koch is a senior software engineer with over 8 years experience designing and architecting primarily web based applications. Fresh out of college during the nineties he co-founded Task Solutions and developed several projects with the then popular classic ASP.
During the Dot Com boom Kevin left his position as president and joined a new venture to build an enterprise insurance claim system build upon J2EE technology. After the Dot Com crash Kevin schooled himself to become an expert with .NET technology and is currently freelancing his ASP.NET skills to build enterprise n-tier frameworks using advanced OO methodologies.