Developing a Data Access Layer for Sybase Using ADO.NET: Essentials
(Page 1 of 5 )
This article mainly focuses on developing a simple DAL (Data Access Layer) for any database using ADO.NET. There exist several types of DAL for Microsoft SQL Server on the Internet (but not much about native Sybase connectivity). In this article, we consider Sybase as the database of choice for developing the DAL.
A downloadable file for this article is available
here.
I enclosed the source code in the form of a single file (“.vb” file). You can use it right away or extend it further based on your needs. The entire discussion in this article will be based on version .NET 1.1.
Contents of the Data Access Layer
The primary job of a Data Access Layer (DAL) is to communicate seamlessly and effectively with the database by minimizing the resources at the server. This is possible only when we separate our business logic layer with the DAL and make the DAL available to a greater number of business logic layers (or even applications).
Considering this from the ADO.NET point of view, to retrieve some information from a database, we generally use some frequent objects such as connection, command, data reader, data adapter, and so on. Just imagine that we would like to bind four drop down lists (at various points in time). We cannot simply open different connections at all the levels, issue several commands and work with many ADO.NET objects every time!
We need to make the data access very simple, reusable, extensible, logable, maintainable, and deployable with several other features. This article doesn’t cover all of the features mentioned, but I tried to make it as simple as possible so that you can further extend it to suit your own needs.
The DAL that we are going to develop now mainly contains the following frequently used routines:
BindDropDownList
BindListBox
getDataRow
getDataSet
getDataTable
getDataView
Those were the routines I used very frequently to retrieve information from any database. I didn’t add any “data manipulations” (like executing an SQL statement) for this DAL yet. But you can add it according to your needs.
Now, let us jump into some of the core issues of native Sybase data access using ADO.NET.
Next: Configuring Sybase for data access using ADO.NET >>
More ASP.NET Articles
More By Jagadish Chaterjee