DataSourceName: String;
The DataSourceName property determines the name of the table, of the file or of the Excel book sheet (depending on type of a data source).
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: