PDA

Click to See Complete Forum and Search --> : ADO: Novice question


Sep 15th, 2000, 03:48 PM
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:

RS.Open "[Update Check]", DB, adOpenForwardOnly

And I'm trying to write to the field like so:

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]

Sep 16th, 2000, 06:04 AM
It still doesn't work.
I'm starting to think I'll never get it working... :(
Any other suggestions?

Sep 16th, 2000, 06:50 AM
Does it have anything to do with the way I'm opening it?

RS.Open "[Update Check]", DB, adOpenForwardOnly

Joacim Andersson
Sep 16th, 2000, 08:18 AM
Yes, a forward only cursor type can't be updated change your code to:

RS.Open "[Update Check]", DB, adOpenDynamic

Good luck!

Sep 16th, 2000, 08:27 AM
It still doens't work, maybe I should change the lock-type?

DrewDog_21
Sep 16th, 2000, 01:19 PM
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:

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:

DB.Execute "UPDATE [Update Check] SET CHECKED = " & CStr(Now) & _
" WHERE IdAutonumberFieldName = " & intCurRecord & ";"