DriverFile

Description

A string containing the full path of the ADO.NET custom driver.

When to specify DriverFile

You must specify the DriverFile parameter before connecting to the database.

Applies to

ADO.NET custom driver

Syntax

DriverFile='driver_path'

Default value

None

Usage

Select Custom Driver from the Provider drop-down list and specify the full path of the driver on the Connection page in the Database Profile Setup dialog box for ADO.NET. (Relative paths, current directory paths, or environment variables are not supported.)

Examples

To use the ADO.NET custom driver to connect to a database:

  • Database profile

    Select Custom Driver from the Provider drop-down list and specify the full path of the driver on the Connection page in the Database Profile Setup dialog box for ADO.NET.

  • Application

    Type the following in code:

    Provider='Custom Driver',DriverFile='D:\mysql\mysqlconnector.2.4.0\lib\net8.0\MySqlConnector.dll'

    Below is a code example for how to concatenate the full path of the MySQL driver with the current directory of the application and then connect with the database (suppose you distribute the driver "Driver_net8.0\MySqlConnector.dll" in the same directory as the application).

    String  ls_DriverPath
    String  ls_CurrentDirectory
    
    //Get the current directory of the application and cancatenate the driver path
    ls_CurrentDirectory = GetCurrentDirectory ( )
    If Right(ls_CurrentDirectory,1) <> '\' And Right(ls_CurrentDirectory,1) <> '/' Then
     ls_DriverPath = ls_currentDirectory + '\Driver_net8.0\MySqlConnector.dll'
    Else
     ls_DriverPath = ls_currentDirectory + 'Driver_net8.0\MySqlConnector.dll'
    End If
    
    // Profile ADO_Mysql
    SQLCA.DBMS = "ADO.Net"
    SQLCA.LogPass = "test123!@#"
    SQLCA.LogId = "root"
    SQLCA.AutoCommit = False
    SQLCA.DBParm = "Provider='Custom Driver',DriverFile='"+ls_DriverPath+"',PROVIDERSTRING='server=172.12.3.45;database=mysql'"
    
    Connect;
    
    If SQLCA.SQLCode <> 0 Then
     
     Messagebox("Connect Database Failed","SQLCode:"+String(SQLCA.SQLCode)+"~r~nSQLErrText:"+SQLCA.SQLERRText)
     Return
     
    End If
    
    Open(w_main)