IOdbcDataset.DataSource

Syntax

DataSource: String;

Description

The DataSource property determines the type of ODBC source.

Example

Executing the example requires the c: \Data.xls file.

Sub Main;

Var

MB: IMetabase;

CrInfo: IMetabaseObjectCreateInfo;

ODBC: IOdbcDataset;

MObj: IMetabaseObject;

Begin

MB := MetabaseClass.Active;

CrInfo := MB.CreateCreateInfo;

CrInfo.ClassID := MetabaseObjectClass.KE_CLASS_ODBC_DS;

CrInfo.Id := "NewODBC";

CrInfo.Name: = "New ODBC data source";

CrInfo.Parent := MB.Root;

MObj := MB.CreateObject(CrInfo).Edit;

ODBC := MObj As IOdbcDataset;

ODBC.Catalog := "c:\Data.xls";

ODBC.DataSource: = "Excel files";

ODBC.DataSourceName: = "[Sheet1$]";

MObj.Save;

End Sub Main;

After executing the example, a new ODBC data source is created in repository root. This data source accesses the Data.xls Excel file.

See also:

IOdbcDataset