Q&A

Q1: I am trying to use the RecordCount property with a recordset, but it just returns a –1. Why?
A1: If you open a recordset with the default CursorType and LockType, it will return –1, indicating the record count is unknown. This is because with a forward-only, read-only cursor, ADO cannot cycle through the recordset to get the record count. Change the CursorType and LockType to get a record count. For instance, set them to be static and use optimistic locking. The penalty you pay for this is speed, so you might want to be careful and only do this when necessary.
Q2: When my component receives the recordset from the data component, it is empty or Null. What's wrong?
A2: Make sure you are not using the Close method on the recordset in ...

Get Sams Teach Yourself Microsoft® Windows® DNA Programming in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.