|
-
Dec 18th, 2008, 11:02 AM
#2
Re: Find AutoIncrement & Primary Key fields in ADODB Recordset
Use the Fields.Properties collection to find some schema information.
The values loaded into the collection depend on how you open the recordset but you get into a catch-22 situation. I only have Access 2002, hopefully it is different with Access 2003.
If the CursorLocation is adUseServer then you can get the AutoIncrement Property.
rs.Fields(0).Properties("IsAutoIncrement").Value
But to get the Key information the CursorLocation needs to be adUseClient.
rs.Fields(0).Properties("KeyColumn").Value
I haven't checked all the possible combinations of the CursorTypes and LockTypes. Maybe there is one that causes ADO to return all information.
Failing that, the Connection.OpenSchema method might work for you. Note that its functionality is not fully implemented in all providers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|