Questions That Should Be Asked More Frequently

[Previous] [Next]

Q. After I call the Save method, will my cursor be positioned at the same record as it was prior to calling this method?

A. No. ADO moves you to the first record in the Recordset after you've called the Save method.

Q. When I call the Requery method on the Recordset object I opened from a file or a stream, the method fails. Have I done something wrong?

A. You've done nothing wrong, but there's nothing more you can do. As of ADO 2.5, you can't call the Requery method when you reopen a persisted Recordset. Perhaps a future release will provide a way to do this. However, you can still call the Resync method successfully.

Q. When I try to open a Recordset from a Stream object, I receive an error message stating that the arguments are the wrong type. Why is that?

A. I noticed behavior that I found surprising when opening a Recordset from a Stream object. Leave the ActiveConnection parameter on the Recordset's Open method blank. Then set the ActiveConnection property on your Recordset object to an open Connection object or a valid connection string, and you should be fine.

Q. Why can't I persist a parameterized hierarchical Recordset?

A. You're getting ahead of yourself a bit. As of ADO 2.5, there's no way to persist such a Recordset. In Chapter 14, we'll examine hierarchical Recordsets in more depth and explain why this limitation currently exists. (Don't worry if this question throws you for a loop.)

Q. Do I need to work with a client-side Recordset in order to use persistent data?

A. No. ADO will let you save the contents of your Recordset even with a server-side cursor. However, if you reopen your Recordset from a file or a stream, that data will be stored by the ADO Cursor Engine.

Q. What does ADO do when I call the Save method on a firehose cursor?

A. When you use a firehose cursor, ADO doesn't store the contents of the records you've already examined. If your cursor has moved beyond the first record in the Recordset, ADO will reexecute your query when you call the Save method. In the first question in this section, I noted that when you call Save, ADO will move your cursor to the first record of the Recordset. For a firehose cursor, this means ADO will reexecute your query in order to move back to the first record after persisting the Recordset. Keep this behavior in mind if you plan to persist data from a firehose cursor, especially if you want to call a stored procedure to generate your data.

Q. Can I reopen my Recordset asynchronously?

A. As of ADO 2.5, yes. Prior to ADO 2.5, your asynchronous request would have been ignored and would have opened synchronously.



Programming ADO
Programming MicrosoftВ® ADO.NET 2.0 Core Reference
ISBN: B002ECEFQM
EAN: N/A
Year: 2000
Pages: 131
Authors: David Sceppa

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net