Microsoft Office Tutorials and References
In Depth Information
Finally, the User ID and Password keywords present authentication information to the
database server. If you wish to use your Windows authentication information—the User ID that
you gave when you logged onto Windows—you can replace the User Id and Password
keywords with the Integrated Security keyword, as in the following connection string:
Provider=SQLOLEDB.1;Data Source=athena.justpc.com;
Initial Catalog=Music;Integrated Security=SSPI
Connecting to Other Databases
As long as you can find the proper data provider you can connect to many different types of
databases. The main requirement is that the database supports OLE DB. Some of these
databases and their providers are listed in Table 23-2.
Table 23-2. Other OLE DB Data Providers
Database
Data Provider(s)
DB2
IBM OLE DB Provider for DB2
Oracle
Microsoft OLE DB Provider for Oracle
Oracle Provider for OLE DB
In case the database you wish to use doesn’t support OLE DB, but supports only ODBC,
Microsoft includes a special data provider named Microsoft OLE DB Provider for ODBC
drivers, which translates OLE DB calls into ODBC. However, you should use this provider
only if you can’t find an OLE DB provider because performance will suffer.
Using the Errors Collection
The Errors collection contains information about the errors that occur while executing a
database command. Because it’s quite possible that one error might trigger several others
when executing a command, you can’t always rely on the VBA Err object to reveal the true
cause of the error. Therefore, the ADO Errors collection contains the full set of errors that
occur while executing a command. (See Table 23-3.)
Table 23-3. Key Properties and Methods of the Errors Collection
Property/Method
Description
Clear
Method: Removes all the items from the collection.
Count
Property: Returns the number of items in the collection.
Item(index)
Property: returns the Error object at the location specified by index .
Search JabSto ::




Custom Search