Resources

Identifying a Data Set to Open

In this recipe, you learn how to use ADO to specify a data set depending on which SAS provider you are using. Sample code is included.

Applies to: SAS Local Data Provider, SAS/SHARE Data Provider, SAS IOM Data Provider
Implement using: ADO or OLE DB

Overview

With the local provider, the data set name is sufficient to identify the data set. The following code fragment requests access to a SAS data set named family.

obRecordset.Open "family", cnSAS, adOpenStatic, adLockReadOnly, adCmdTableDirect

With the SAS IOM provider and SAS/SHARE provider, you must use the standard SAS libname.memname notation to identify data sets. The basic ADO syntax is shown in the following code fragment:

obRecordset.Open "mylib.cities", obConnection, adOpenStatic, adLockReadOnly, adCmdTableDirect

Details

Command Types

The value of the CommandType property determines whether or not the recordset can be modified.

The adCmdTableDirect command type can be used with all the providers. However, the adCmdTable command type—which executes a SQL SELECT * FROM libname.memname query—can only be used with the SAS IOM and SAS/SHARE providers. The local provider does not support SQL processing.

Library References

When you use the libname.memname notation with the SAS/SHARE and SAS IOM providers, the referenced libname must be defined in the server. With a SAS/SHARE server, this is done by the server administrator. There are a number of ways to assign a libref in an IOM server; see Assigning a Libref to Use with the IOM Provider.