Powered by Zoomin Software. For more details please contactZoomin

DataDirect OpenAccess SDK Help

Example 1: Using the Provider-Specific Objects

Example 1: Using the Provider-Specific Objects

  • Last Updated: May 12, 2026
  • 2 minute read
    • OpenAccess SDK
    • Version 8.1
    • Documentation

The following example uses the provider-specific objects to connect to a database using the data provider from an application developed in Visual Studio using C#.

  1. In the Solution Explorer, right-click References, and then select Add Reference.

  2. Select the OpenAccess SDK data provider in the component list of the Add Reference dialog box.

  3. Click OK. The Solution Explorer now includes DDTek.OpenAccess, the assembly for the OpenAccess SDK data provider.
    Solution Explorer window with the data provider added.

  4. Add the data provider’s namespace to the beginning of your application, as shown in the following C# code fragment:

    // Access database

    using System.Data;

    using OpenAccess.dll;

  5. Add the connection information for your server and exception handling code, and close the connection, as shown in the following C# code fragment:

    OpenAccessConnection DBConn = new OpenAccessConnection("Host=test; Port=19986;User ID=test01;Password=test01");
    try
    {
    DBConn.Open();
    Console.WriteLine ("Connection successful!");
    }
    // Display any exceptions ddd
    catch (OpenAccessException ex)
    {
    // Connection failed
    Console.WriteLine(ex.Message);
    return;
    }
    
  6. Close the connection.

    // Close the connection
    Conn.Close();
    
TitleResults for “How to create a CRG?”Also Available inAlert