ODBCParamValue(Name: String): Variant;
Name. Parameter name.
The ODBCParamValue property determines a value for parameter with the specified name.
Parameter names can be obtained in documentation for the ODBC driver, which was used for connection.
The operating system must have Microsoft SQL Server ODBC driver installed. The network has a server named MSSQLServer, the DataRepository schema is created on the server.
Add a link to the Dal system assembly.
Sub UserProc;
Var
Driver: IDalDriver;
ConDesc: IDalConnectionDescriptor;
Params: IDalConnectionDescriptorParams;
Con: IDalConnection;
ParamsODBC: IDalODBCConnectionDescriptor;
Begin
// Connection driver
Driver := New DalMsSql2012ODBCDriver.Create As IDalDriver;
// Connection description
ConDesc := Driver.CreateDescriptor;
Params := ConDesc.Params;
// Set up connection parameters
Params.Find("Host BSTR").Value := "MSSQLServer";
Params.Find("Database").Value := "DataRepository";
Params.Find("User Name").Value := "User";
Params.Find("Password").Value := "Password";
// Additional connection parameters
ParamsODBC := ConDesc as IDalODBCConnectionDescriptor;
ParamsODBC.ODBCParamValue("MultiSubnetFailover") := "Yes";
ParamsODBC.ODBCParamValue("ApplicationIntent") := "ReadOnly";
Con := ConDesc.CreateConnection;
Con.Open;
If Con.IsDisconnected Then
Debug.WriteLine("No connection.");
Else
Debug.WriteLine("Connected successfully.");
End If;
End Sub UserProc;
After executing the example, a new connection to the specified server is created. The connection is implemented via ODBC driver with setting additional connection parameters. The connection result is displayed in the development environment console.
See also: