IPrimaryODBCSPLD.ODBCParamValue

Syntax

ODBCParamValue(Name: String): Variant;

Parameters

Name. Parameter name.

Description

The ODBCParamValue property 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 links to the Db and Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    CrInfo: IMetabaseObjectCreateInfo;
    MObj: IMetabaseObject;
    DB: IDatabase;
    LogonData: IPrimaryODBCSPLD;
    PasswordCreds: IPasswordCredentials;
Begin
    MB := MetabaseClass.Active;
    CrInfo := MB.CreateCreateInfo;
    CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_DATABASE;
    CrInfo.Id := 
"ODBC_DB";
    CrInfo.Name := 
"Connection via ODBC1";
    CrInfo.Parent := MB.Root;
    MObj := MB.CreateObject(CrInfo).Edit;
    DB := MObj 
As IDatabase;
    DB.Authentication := AuthenticationMode.Password;
    DB.DriverId := 
"ODBC";
    LogonData := DB.LogonData 
As IPrimaryODBCSPLD;
    LogonData.ODBCParamValue(
"DRIVER") := "{ODBC Driver 13 for SQL Server}";
    LogonData.ODBCParamValue(
"SERVER") := "MSSQLServer";
    LogonData.ODBCParamValue(
"DATABASE") := "DataRepository";
    DB.LoginPrompt := 
False;
    PasswordCreds := DB.Credentials 
As IPasswordCredentials;
    PasswordCreds.UserName := 
"User";
    PasswordCreds.Password := 
"Password";
    MObj.Save;
End Sub UserProc;

After executing the example, a new database is created in the repository root folder, which allows for connecting to data sources via Microsoft SQL Server ODBC driver.

See also:

IPrimaryODBCSPLD