The provider-specific property set DBPROPSET_ADSROWSET can be accessed from ADO Recordset objects. For details and valid values for each property, see Provider-Specific Rowset Properties.
The following is the mapping between the "friendly" property name and the property ID.
Property ID |
Property Name |
ADSPROP_LAST_AUTOINC |
Last AutoInc |
ADSPROP_ROWSET_HANDLE |
ACE Recordset Handle |
Note The autoinc value returned is client-specific, and because of concurrent database access, is not guaranteed to be the absolute last autoinc value in the table.
After a table has been opened directly or a cursor opened by executing an SQL SELECT statement, the value for these properties can be retrieved from the Recordset properties collection. For example:
cmd.CommandText = "INSERT INTO table (field1) VALUES ('value1')"
cmd.Execute
LastAutoInc = cmd.Properties.Item("Last AutoInc")
rs.Open "customers", , , , adCmdTableDirect
lHandle = rs.Properties.Item("ACE Recordset handle")
lResult = AdsLockRecord( lHandle, 69 ) ‘ This allows record 69 in the customers table to be locked directly