This article is written to see the importance of having a separate Data Access layer.
A good data access layer is critical for most business applications, whether that layer resides on a middle tier application server, a web server or on the client. Data access layers tend to involve a lot of error-prone, repetitive coding if you try to do it by hand. You can alleviate some of that by designing a good set of base and helper classes to encapsulate the repeating patterns, or by using a code generation tool. However, you still usually have to write all the data access methods by hand for the ad-hoc queries that service large parts of your application.
Now let me talk about the 3 tier architecture
The GUI layer
The GUI is the "top layer". It contains all things that are visible to the user, the 'outside' of the system, such as screen layout and navigation.
The GUI layer has techniques like HTML, CSS, Applet, Servlet, JSP, JHTML.
The Business layer
This is the core of the system, the linking pin between the other layers. Business-objects and data storage should be brought as close together as possible, ideally they should be together physically on the same server. This way - especially with complex accesses - network load is eliminated. The client only receives the results of a calculation - through the business-layer ofcourse.
Database Layer
The database layer takes care of persistency. An object from the database layer can write itself to one or more tables. In the database layer you'll find things like database, connection, table, SQL and result set.
Advantages
- With the right approach the 3-tier architecture saves development manpower. Code each bit only once, with powerful re-usage.
- Divide and conquer strategy. Every layer is rather easy to develop. Better have 3 simple parts that one complex whole.
- Quality. For each layer a specialist can contribute specific expertise, a GUI Designer for the user interface, a Java programmer for the object layer, and a Database Designer for the tables.
With this article,I have attached the project for Data layer implementation in c#.