The Data Access Application Block is a .NET component that is provided by Microsoft, which encapsulates data access functionality. The wrapper class conforms to the best patterns and practices and provides methods for the major data access classes such as: SqlDataReader, DataSet, and the XMLReader.
Enough of the Data Access Application Block fluff; why should I use it? The answer is simple; it cuts your data access code in half. We all have come to know and love the great, ADO.NET, but let's face it ? it becomes very repetitive. Here is just a small taste of how the DAAB can help you:
"In order to illustrate the advantage of using the Data Access Block, let's take a look at sample code that creates a SqlDataReader object and binds it to a DataGrid without using the Data Access Block. In general, returning a DataReader involves establishing a connection, creating a SqlCommand, and executing the command against the database. The resulting SqlDataReader object can then be bound to a DataGrid:"
//create the connection string and sql to be executed
string strConnTxt = "Server=(local);Database=Northwind;Integrated Security=True;";
string strSql = "select * from products where categoryid = 1";
//create and open the connection object
SqlConnection objConn = new SqlConnection(strConnTxt);
objConn.Open();
//Create the command object
SqlCommand objCmd = new SqlCommand(strSql, objConn);
objCmd.CommandType = CommandType.Text;
//databind the datagrid by calling the ExecuteReader() method
DataGrid1.DataSource = objCmd.ExecuteReader();
DataGrid1.DataBind();
//close the connection
objConn.Close();
"Now lets look at the same task using the SqlHelper class's static ExecuteReader() method:"
//create the connection string and sql to be executed
string strSql = "select * from products where categoryid = 1";
string strConnTxt = "Server=(local);Database=Northwind;Integrated Security=True;";
I'm using current version 2.0 of the DAAB. It has cut my repetitive code down drastically, and has really streamlined the way I interact with my SQL Server 2000 backend. If you're current application isn't taking advantage of this .NET component, I suggest you read the documentation and download the Data Access Application Block for .NET.