|
Description
|
Returns/sets a value that provides information about the source of an open connection or an open database. Restituisce od imposta la stringa di connessione ODBC.
|
Syntax Visual Basic
|
[form.]Postel.Connect[ = Text$]
|
|
Visual C++
|
CString Postel.GetConnect(); void Postel.SetConnect(LPCTSTR lpszNewValue);
|
|
Delphi
|
property Connect: WideString;
|
|
C#
|
string Postel.Connect;
|
|
Remarks
|
The Connect property syntax has two parts:
| Part | Description | | databasetype | Optional. A String that specifies a database type. For Microsoft Jet databases, exclude this argument; if you specify parameters, use a semicolon (;) as a placeholder. | | parameters | Optional. A String that specifies additional parameters to pass to ODBC or installable ISAM drivers. Use semicolons to separate parameters. |
The Connect property setting is a String composed of a database type specifier and zero or more parameters separated by semicolons. The Connect property passes additional information to ODBC and certain ISAM drivers as needed. To perform an SQL pass-through query on a table linked to your Microsoft Jet database (.mdb) file, you must first set the Connect property of the linked table's database to a valid ODBC connection string. For base tables in a Micorosoft Jet database (.mdb), the Connect property setting is a zero-length string (""). The following table shows possible database types and their corresponding database specifiers and paths for the Connect property setting. In an ODBCDirect workspace, only the "ODBC" specifier can be used: | Database type | Specifier | Example | | Microsoft Jet Database | [database]; | drive:\path\filename.mdb | | dBASE III | dBASE III; | drive:\path | | dBASE IV | dBASE IV; | drive:\path | | dBASE 5 | dBASE 5.0; | drive:\path | | Paradox 3.x | Paradox 3.x; | drive:\path | | Paradox 4.x | Paradox 4.x; | drive:\path | | Paradox 5.x | Paradox 5.x; | drive:\path | | Microsoft Excel 3.0 | Excel 3.0; | drive:\path\filename.xls | | Microsoft Excel 4.0 | Excel 4.0; | drive:\path\filename.xls | | Microsoft Excel 5.0 or Microsoft Excel 95 | Excel 5.0; | drive:\path\filename.xls | | Microsoft Excel 97 | Excel 8.0; | drive:\path\filename.xls | | Lotus 1-2-3 WKS and WK1 | Lotus WK1; | drive:\path\filename.wk1 | | Lotus 1-2-3 WK3 | Lotus WK3; | drive:\path\filename.wk3 | | Lotus 1-2-3 WK4 | Lotus WK4; | drive:\path\filename.wk4 | | HTML Import | HTML Import; | drive:\path\filename | | HTML Export | HTML Export; | drive:\path | | Text | Text; | drive:\path | | ODBC | ODBC; DATABASE=database; UID=user; PWD=password; DSN= datasourcename; [LOGINTIMEOUT=seconds;] | None | | Microsoft Exchange | Exchange 4.0; MAPILEVEL=folderpath; [TABLETYPE={ 0 | 1 }];[PROFILE=profile;] [PWD=password;] [DATABASE=database;] | drive:\path\filename.mdb |
Here are some Connect string samples:
'Access Postel1.Connect = "" Postel1.DatabaseName = "c:\...\test.mdb" Postel1.RecordSource = "SELECT CustomerID, ShippedDate FROM Orders"
'Text Postel1.Connect = "Text;" Postel1.DatabaseName = "C:\Directory"
'Excel 5.0 Postel1.Connect = "Excel 5.0;" Postel1.DatabaseName = "C:\...\Test.xls"
'SQLServer 7 Postel1.Connect = "ODBC;DSN=TestSQLServer7;SERVER=_ (local);UID=sa;PWD=;WSID=UserID;DATABASE=TestDB" Postel1.DatabaseName = "TestDB"
'InterBase Postel1.Connect = "ODBC;DSN=InterBaseTest;UID=SYSDBA;_ PWD=masterkey;DB=\\Server\InterBase\Employee.gdb" Postel1.DatabaseName = "InterBaseTest" 'This is the User Data Source Name
'Oracle Postel1.Connect = "ODBC;DSN=TestOra;UID=SCOTT;PWD=TIGER;"
La sintassi della proprietà Connect è costituita dalle parti riportate di seguito.
| Parte | Descrizione | | tipodatabase | Opzionale. Tipo di dati String che specifica un tipo di database. Per i database del modulo di gestione di database Microsoft Jet, escludere questo argomento. Se si specifica parametri, utilizzare un punto e virgola (;) come segnaposto. | | parametri | Opzionale. Tipo di dati String che specifica dei parametri aggiuntivi da passare a un driver ODBC o ISAM installabile. Utilizzare un punto e virgola per separare i parametri. |
L'impostazione della proprietà Connect è una stringa composta da una specifica del tipo di database e zero o più parametri separati dal punto e virgola. La proprietà Connect viene utilizzata per passare informazioni aggiuntive a driver ODBC e ad alcuni driver ISAM, secondo necessità. Per eseguire una query SQL di tipo pass-through su una tabella collegata al file MDB del database Microsoft Jet, è necessario prima impostare la proprietà Connect del database della tabella collegata ad una stringa di connessione ODBC valida. Nel caso di tabelle base di database Jet (MDB), l'impostazione della proprietà Connect è una stringa a lunghezza zero (""). La tabella precedente indica alcuni tipi possibili di database con le specificazioni e i percorsi corrispondenti per l'impostazione della proprietà Connect. In un'area di lavoro ODBCDirect, è possibile utilizzare solo "ODBC".
|
|
Data Type
|
String
|