Powered by Zoomin Software. For more details please contactZoomin

DataDirect Connect for ADO.NET Data Provider Help

Data Access Application Block Overview

  • Last Updated: April 16, 2026
  • 5 minute read
    • ADO.NET
    • Documentation

The Data Access Application Block (DAAB) is designed to allow developers to replace ADO.NET boiler-plate code with standardized code for everyday database tasks. The overloaded methods in the Database class can:

  • Return scalar values.
  • Determine which parameters are needed and create them.
  • Involve commands in a transaction.

If your application needs to address specific DBMS functionality, you can use a DataDirect Connect for ADO.NET data provider.

When Should You Use DAABs?

DAABs include a small number of methods that simplify the most common methods of accessing a database. Each method encapsulates the logic required to retrieve the data and manage the connection to the database. You should consider using the application block if your application uses standard data access techniques.

The DAAB is used with ADO.NET, increasing efficiency and productivity when creating applications for ADO.NET. The abstract Database class provides a number of methods, such as ExecuteNonQuery, ExecuteReader, and ExecuteScalar, that are the same as the methods that are used by the DbCommand class, or, if you are using database-specific code, a data provider-specific class such as OracleCommand.

Although using the default DAAB during development is convenient, the resulting application lacks portability. When you use the provider-specific DataDirect Connect for ADO.NET DAAB implementation, the application includes the DataDirect Connect data providers’ SQL leveling capabilities. You have more flexibility, whether your application needs to access multiple databases, or whether you anticipate a change in your target data source.

Should You Use Generic or Database-specific Classes?

The application block supplements the code in ADO.NET that allows you to use the same code with different database types. You have two choices when using the DAAB with DataDirect Connect for ADO.NET:

  • The GenericDatabase class
  • The provider-specific DAAB implementation

The GenericDatabase class option is less suited to applications that need specific control of database behaviors. For portability, the GenericDatabase solution is the optimal approach.

If your application needs to retrieve data in specialized way, or if your code needs customization to take advantage of features specific to a DBMS, using the DataDirect Connect for ADO.NET data provider for that DBMS might be better suited to your needs.

Configuring the DAAB

Before you can configure the DAAB for use with your application, you must set up the environment:

  1. Make sure that you have installed Microsoft Enterprise Library 6.0.
  2. Open the DataDirect Enterprise Library project for your data provider, located in install_dir\Enterprise Libraries\Src\CS<provider>. The default configurations were created with Microsoft Enterprise Library 6.0.
  3. Compile your project and note the output directory.

Configuring the Data Access Application Block consists of two procedures:

  • Adding a New DAAB Entry
  • Adding the Data Access Application Block to Your Application

Adding a New DAAB Entry

Now, use the Enterprise Library Configuration Tool to add a new DAAB entry. This procedure uses the configuration options for the .NET Framework 4.5 and the DB2 Enterprise Library sample solution.

To configure the Data Application Block on any supported platform:

  1. Right-click on your project in Solution Explorer. Select Add / New Item. The Add New Item window appears.

  2. Select the Application Configuration File template. Then, click Add. The App.config file is added to the the project.

  3. Right-click the App.config file. Choose Edit Configuration File.

    Enterprise Library Configuration window

  4. The App.config file is displayed.

    Enterprise Library Configuration window with Application Settings and Database Settings titles.

  5. Click the expander arrow button (Expander arrow button) to the left of the Database Settings title to display the configured connection strings.

  6. Click the plus sign button (Plus sign button) in the Database Instances column and select Add Database Connection String. This adds a new connection string item to the configuration.

    Enterprise Library Configuration window with the Database Connection String fields visible.

  7. In the Name field, enter a name for the DAAB’s connection string, for example, MyDB2.

  8. In the Connection String field, click the ellipsis button (Ellipsis button) to display the Edit Text Value dialog box. Type or paste a connection string in the text box and click OK.

    For example, type:

    Database Name=XXXXX;Host=dev1;Port=6070;User ID=XXXXX;Encryption Method=SSL;AuthenticationMethod=Kerberos;
    
  9. In the Database Provider drop-down list, select the data provider. For example, select DDTek.DB2.4.3 for the DB2 data provider.

  10. Click the chevron button (Chevron button) to the right of the Database Settings title. In the Default Database Instance drop-down list, select the instance that you want to use.

    Enterprise Library Configuration window with the DB2 data provider selected and a default database instance defined

  11. Select File / Save.

Adding the Data Access Application Block to Your Application

To add the DAAB to a new or existing application, perform these steps:

  1. Add the following References to your Visual Studio solution:

    • Microsoft.Practices.EnterpriseLibrary.Common.dll
    • Microsoft.Practices.EnterpriseLibrary.Data.dll
    • Microsoft.Practices.ServiceLocation.dll </
  2. Add the following directive to your C# source code:

    using Microsoft.Practices.EnterpriseLibrary.Data;
    using System.Data;
    
  3. Rebuild the solution to ensure that the new dependencies are functional.

  4. Determine the output Debug or Release path location of your current solution, and switch back to the Enterprise Library Configuration window (see Adding a New DAAB Entry).

  5. If you want to use the Progress DataDirect Enterprise Library, use the DDTek.EnterpriseLibrary.Data.XXX.dll file, which got created when Enterprise Library source was built.

Using the Data Access Application Block in Application Code

Now that you have configured the DAAB, you can build applications on top of this DAAB.

In the following example, we use the DAAB MyDB2 and the DatabaseFactory to generate an instance of a Database object backed by a DB2 data source.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data;
 
namespace DAAB_Test_App_1
{
    class Program
    {
        static void Main(string[] args)
        {
            Database database = DatabaseFactory.CreateDatabase("MyOracle");
            DataSet ds = database.ExecuteDataSet(CommandType.TableDirect, "SQLCOMMANDTEST_NC_2003SERVER_1");
               
        }
    }
}

The Microsoft Enterprise Library DAAB coding patterns are now at your disposal.

TitleResults for “How to create a CRG?”Also Available inAlert