>> ADO Updateable recordset

J

Jonathan

Hi Access 2003, Sql 2005. Hi I am using Set rs = cmd.Execute to load an ADODB
recordset. However "The default cursor for an ADO Recordset is a
forward-only, read-only cursor located on the server."
I am using a command object so that I can set parameters for a stored
procedure.
Is there a method that I can use to set the cursor type to keyset? That is,
I want to have a stored procedure with parameters as recordset source. I want
to be able to make changes to the recordset (these changes are not saved to a
table).

Any ideas or suggestions appreciated. :)

Many thanks,
Jonathan
 
B

Banana

Any recordset set by this syntax:

Set rs = cmd.Execute

Will be *always* a forward-only read-only cursor if the cursor is server
side, otherwise, a static, read-only client side cursor.

To use recordset with defined parameters and keep the cursor type, use
this syntax:

With cmd
.Execute
rs.Open cmd
End With

This will provide you the recordset created by the command object while
preserving the cursor types & lock types.
 
B

Banana

Oops, not entirely accurate.

Either this:

With cmd
.Parameters(0) = ...
rs.Open cmd
End With

Or this:

With cmd
.Execute l, Array(x, y, z)
rst.Open cmd
End With

The difference being that .Execute method isn't required if you've
already set the parameters unless you choose to use Execute to pass into
parameters.
 
J

Jonathan

awesome, thanks.

Jonathan

Banana said:
Oops, not entirely accurate.

Either this:

With cmd
.Parameters(0) = ...
rs.Open cmd
End With

Or this:

With cmd
.Execute l, Array(x, y, z)
rst.Open cmd
End With

The difference being that .Execute method isn't required if you've
already set the parameters unless you choose to use Execute to pass into
parameters.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top