The following
sample Visual Basic code uses the ADO Command and Recordset objects
in order to access Oracle data. The record set is opened for read-only
access as indicated by
adLockReadOnly
.
' obConnection is an open Connection object.
Dim obRecordset As New ADODB.Recordset
Dim obCommand As New ADODB.Command
obCommand.ActiveConnection = obConnection
'Assign a libref by executing a LIBNAME statement that identifies the SAS/ACCESS engine.
obCommand.CommandType = adCmdText
obCommand.CommandText = "libname mylib oracle user=todd password=king path=oraclev7;"
obCommand.Execute
'Open the data set for read-only access.
obRecordset.Open "mylib.dept", obConnection, adOpenStatic, adLockReadOnly, adCmdTableDirect
Note: The syntax
that you use in your LIBNAME statement depends on the
SAS/ACCESS engine
that you are using and on your operating environment.
SAS/ACCESS engines
are implemented differently in different operating environments. See
the documentation for your DBMS for more information.
Note: If you are
writing directly to the OLE DB interface, use OLE DB rowset methods
in order to read the
SAS/ACCESS data set. To open the rowset for read-only
access, set the DBPROP_IRowsetChange property to
False
.