Re: Cloned recordsets with SQL Server 2005



JD wrote:
I found an odd issue. We have existing VB6 code (ADO 2.8) that
creates a read-write (adLockbatchOptimistic) recordset using a
command object (e.g. rs.Open cmd, ...), with a client side cursor and
a stored proc with parameters. The consuming code takes the
recordset, and generates cloned recordsets (e.g. rs.Clone) for
additional display grids. When something is changed in the grid, the
underlying recordset is updated in code. The actual posting of
changes to the DB is done by reading the recordset and issuing
separate UPDATE, DELETE, or INSERT SQL statements, not by using the
recordset to to update through a connection object.

When running against SQL Server 2000, things always worked well.
When we restored a working database to SQL 2005, and ran the client
code against it, everything worked fine except for this one use of
recordsets. We received "multiple-step operation" errors when trying
to write a recordset field value, but only to certain fields. And
this only occurs on the SQL 2005 DB.

I found a workaround by writing a "CopyRecordset" method that copies
the recordset that has the command object to a new recordset with no
command object or connection. Then it works fine for SQL 2000 and
SQL 2005. I hunted on MSDN and Google for articles on the
"multiple-step operation" errors , and read dozens of them, but to no
avail.

If someone is aware of a solution for this, I'd appreciate knowing
about it so I can use something other than my workaround.

Thanks in advance

You're going to have to help us reproduce this issue. Post a table creation
script with just the minimum number of columns needed to reproduce the
symptoms. Provide some sample data in the form of INSERT...VALUES
statements, and the snip of code that will reproduce the symptoms.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


.



Relevant Pages

  • Re: Which is best - recordsets/VBA V SQL statements for updating data
    ... One typical requirement was a client who required a report that forecast ... > SQL is better than Recordset Updating and Vice Versa. ... Is this a job for SQL or for Recordset ... > Procedure or UDF on the Server machine, using loops, conditional, ...
    (comp.databases.ms-access)
  • Re: Command Oject to pass parameters and CursorLocation
    ... recieved any results in my recordset. ... The Cursor location for RecordSet returned is whatever the current Cursor ... Location of the underlying Connection for Command object is set to. ... DO NOT set Connection. ...
    (microsoft.public.data.ado)
  • Re: Command Oject to pass parameters and CursorLocation
    ... recieved any results in my recordset. ... The Cursor location for RecordSet returned is whatever the current Cursor ... Location of the underlying Connection for Command object is set to. ... DO NOT set Connection. ...
    (microsoft.public.data.ado)
  • Re: Command Oject to pass parameters and CursorLocation
    ... recieved any results in my recordset. ... The Cursor location for RecordSet returned is whatever the current Cursor ... Location of the underlying Connection for Command object is set to. ... DO NOT set Connection. ...
    (microsoft.public.data.ado)
  • Re: reusing command object
    ... the recordset and make updates to certain records. ... Dim cmd As New ADODB.Command ... Dim rst As ADODB.Recordset ... command object as its connection parameter. ...
    (microsoft.public.access.adp.sqlserver)