IPrimaryMsSqlODBCSPLD.ODBCParamValue

Syntax

ODBCParamValue(Name: String): Variant;

ODBCParamValue[Name: String]: Object;

Parameters

Name. Parameter name.

Description

The ODBCParamValueproperty determines a parameter value with the specified index.

Comments

Parameter names can be obtained in documentation for the ODBC driver, which was used for connection.

Example

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 Metabase system assembly. In Fore.NET also add links to the WinForms.Utils system assembly.

Sub UserProc;
Var
    MbMan: IMetabaseManager;
    MbDefs: IMetabaseDefinitions;
    MbDef: IMetabaseDefinition;
    MssqlOdbcSPLD: IPrimaryMsSqlODBCSPLD;
Begin
    MbMan := MetabaseManagerFactory.Active;
    MbDefs := MbMan.Definitions;
    MbDef := MbDefs.Add;
    MbDef.DriverId := 
"MSSQL2012ODBC";
    MbDef.Id := 
"MSSQL_ODBC";
    MbDef.Name := 
"MSSQL_ODBC";
    MbDef.Authentication := AuthenticationMode.Password;
    MbDef.SecurityPackage := 
"STANDARDSECURITYPACKAGE";
    MssqlOdbcSPLD := MbDef.LogonData 
As IPrimaryMsSqlODBCSPLD;
    MssqlOdbcSPLD.Server := 
"MSSQLServer";
    MssqlOdbcSPLD.Database := 
"DataRepository";
    MssqlOdbcSPLD.ODBCParamValue(
"MultiSubnetFailover") := "Yes";
    MssqlOdbcSPLD.ODBCParamValue(
"ApplicationIntent") := "ReadWrite";
    MbDef.Save;
End Sub UserProc;

Imports Prognoz.Platform.PiLibNet.Utils;
Imports Prognoz.Platform.Interop.Metabase;

Public Shared Sub UserProc();
Var
    ManagerFactory: IMetabaseManagerFactory;
    MbMan: IMetabaseManager;
    MbDefs: IMetabaseDefinitions;
    MbDef: IMetabaseDefinition;
    MssqlOdbcSPLD: IPrimaryMsSqlODBCSPLD;
Begin
    ManagerFactory := ComCreator.Instance.CoCreate<MetabaseManagerFactoryClass>();
    MbMan := ManagerFactory.Active;
    MbDefs := MbMan.Definitions;
    MbDef := MbDefs.Add();
    MbDef.DriverId := 
"MSSQL2012ODBC";
    MbDef.Id := 
"MSSQL_ODBC";
    MbDef.Name := 
"MSSQL_ODBC";
    MbDef.Authentication := AuthenticationMode.amPassword;
    MbDef.SecurityPackage := 
"STANDARDSECURITYPACKAGE";
    MssqlOdbcSPLD := MbDef.LogonData 
As IPrimaryMsSqlODBCSPLD;
    MssqlOdbcSPLD.Server := 
"MSSQLServer";
    MssqlOdbcSPLD.Database := 
"DataRepository";
    MssqlOdbcSPLD.ODBCParamValue[
"MultiSubnetFailover"] := "Yes";
    MssqlOdbcSPLD.ODBCParamValue[
"ApplicationIntent"] := "ReadWrite";
    MbDef.Save();
End Sub;

After executing the example, a new description for connecting to the specified repository is created. The connection is implemented using the ODBC driver with the ability to set additional connection parameters.

See also:

IPrimaryMsSqlODBCSPLD