Results 1 to 6 of 6

Thread: ADO: Novice question

  1. #1
    Guest

    Talking

    I'm new to DB programming, and I just started using ADO.
    I know how to open connection, recordsets, read fields, etc...
    But how do I write to a specified field?
    I'm opening my recordset like so:
    Code:
    RS.Open "[Update Check]", DB, adOpenForwardOnly
    And I'm trying to write to the field like so:
    Code:
    RS.MoveFirst
    RS.Move intCurRecord
    RS.Fields("Checked").Value = CStr(Now)
    And when I run the app it gives me the following error:
    Run-time error '3251':

    Object or provider is not capable of performing requested operation.


    I'm using an Access DB, ADO 2.5, and MS Jet.

    Can anyone help me with this?



    [Edited by Sc0rp on 09-15-2000 at 04:52 PM]

  2. #2
    Guest
    It still doesn't work.
    I'm starting to think I'll never get it working...
    Any other suggestions?

  3. #3
    Guest
    Does it have anything to do with the way I'm opening it?
    Code:
    RS.Open "[Update Check]", DB, adOpenForwardOnly

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Yes, a forward only cursor type can't be updated change your code to:
    Code:
    RS.Open "[Update Check]", DB, adOpenDynamic
    Good luck!

  5. #5
    Guest
    It still doens't work, maybe I should change the lock-type?

  6. #6
    Hyperactive Member
    Join Date
    Nov 1999
    Location
    Columbia, SC USA
    Posts
    374
    try putting a SELECT statement in your open routine, and
    change the lock type to Optimistic Locking. I can't
    guarantee that will work but give it a shot:
    Code:
    RS.Open "Select * From [Update Check]", DB, adOpenKeyset, adLockOptimistic
    and then perform your operation.

    Or, if all you are doing to the table is modifying a record,
    then you may not need to open a recordset because you can
    execute SQL using an ADO Connection Object and the .Execute
    method, like this:
    Code:
    DB.Execute "UPDATE [Update Check] SET CHECKED = " & CStr(Now) & _
    " WHERE IdAutonumberFieldName = " & intCurRecord & ";"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width