Edit/Update record in keyset resultset 
Author Message
 Edit/Update record in keyset resultset

I have a keyset resultset that contains records that will be updated and
deleted.  The first time I update a record it works fine.  However, when I
try to update the same record it comes back with and error "No Record
updated or deleted."  I believe this is because I have already updated the
record and the optimistic check catches it however I don't want it to catch
it.

Is there a way to accomplish this?

Barry



Sat, 21 Aug 1999 03:00:00 GMT  
 Edit/Update record in keyset resultset

Here is some sample code:

        ' If the data is valid
        If ValidTableData Then
           ' invoke the edit method optimistic locking is on
           rdoRset.Edit
               ' Fill the resultset fields with the new data
           Call FillResultset
               ' Invoke the update method
           rdoRset.Update
        end if

Each time the update button is pressed I run this piece of code.  Let me
know if you would like more detail.

Thanks,

Barry



Quote:
> We need some sample code here. Are you using the .Edit method everytime
> you're trying to call .Update?

> Andy Hopper




Sat, 21 Aug 1999 03:00:00 GMT  
 Edit/Update record in keyset resultset

I tried this code and didn't have any problems. Inspect this and see if
there are any missing pieces.

Private Sub Test()
    Dim MyrdoConnection As rdoConnection
    Dim MyrdoResultset As rdoResultset
    Set MyrdoConnection = rdoEngine.rdoEnvironments(0).OpenConnection(<Your
DSN>)
    Set MyrdoResultset = MyrdoConnection.OpenResultset("Select * from
Temp1", rdOpenKeyset, rdConcurRowver)
    MyrdoResultset.Edit
    MyrdoResultset("LastName") = "Hopper"
    MyrdoResultset.Update
    MyrdoResultset.Edit
    MyrdoResultset("FirstName") = "Andy"
    MyrdoResultset.Update
    'Always put up your toys...
    MyrdoResultset.Close
    Set MyrdoResultset = Nothing
    MyrdoConnection.Close
    Set MyrdoConnection = Nothing
End Sub

I also ran it where it just updated the same field (.edit, new info,
update...) twenty times and it didn't break.

Cheers!
Andy Hopper



Sat, 21 Aug 1999 03:00:00 GMT  
 Edit/Update record in keyset resultset

We need some sample code here. Are you using the .Edit method everytime
you're trying to call .Update?

Andy Hopper



Sat, 21 Aug 1999 03:00:00 GMT  
 Edit/Update record in keyset resultset

I am experiencing the problem with ODBC (client-side) cursors only.  If I
use all the default settings (server side) then I do not have a problem.  I
am using VB 4.0, RDO 1.0b, and SQL Server 6.5.

Thanks,

Barry



Quote:
> I tried this code and didn't have any problems. Inspect this and see if
> there are any missing pieces.

> Private Sub Test()
>     Dim MyrdoConnection As rdoConnection
>     Dim MyrdoResultset As rdoResultset
>     Set MyrdoConnection =

rdoEngine.rdoEnvironments(0).OpenConnection(<Your
Quote:
> DSN>)
>     Set MyrdoResultset = MyrdoConnection.OpenResultset("Select * from
> Temp1", rdOpenKeyset, rdConcurRowver)
>     MyrdoResultset.Edit
>     MyrdoResultset("LastName") = "Hopper"
>     MyrdoResultset.Update
>     MyrdoResultset.Edit
>     MyrdoResultset("FirstName") = "Andy"
>     MyrdoResultset.Update
>     'Always put up your toys...
>     MyrdoResultset.Close
>     Set MyrdoResultset = Nothing
>     MyrdoConnection.Close
>     Set MyrdoConnection = Nothing
> End Sub

> I also ran it where it just updated the same field (.edit, new info,



Sat, 21 Aug 1999 03:00:00 GMT  
 Edit/Update record in keyset resultset

The only advice I can render is to set the .CursorDriver property to
rdUseIf Needed and see if that fixes it. Failing that, move to server-side
cursors.
By the way, you're not fooling around with text/image fields, are you? They
caused _major_ headaches for us when we tried to run stored procedures that
returned multiple resultsets.

Cheers!
Andy Hopper



Sat, 21 Aug 1999 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Edit/Update record in keyset resultset

2. RDO I open a keyset but I get a static resultset

3. How do I edit/update an existing record?

4. Help: Edit will only update first record stored

5. Problem in Editing the Record in Batch Update mode ADODB.RescordSet

6. Problem in Editing the Record in Batch Update mode ADODB.RescordSet

7. Editing and Updating a Record

8. Updating Links in Word 2002, Edit, Links, Select Update Method

9. RDO/VB5 Illegal resultset state for update, fixed?

10. ADo ADD New and Update also Edit Update

11. RDO ResultSet can't update/delete

12. Private Resultset vs. Public Resultset

 

 
Powered by phpBB® Forum Software