|
-
Sep 15th, 2000, 03:48 PM
#1
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]
-
Sep 16th, 2000, 06:04 AM
#2
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
#3
Does it have anything to do with the way I'm opening it?
Code:
RS.Open "[Update Check]", DB, adOpenForwardOnly
-
Sep 16th, 2000, 08:18 AM
#4
Yes, a forward only cursor type can't be updated change your code to:
Code:
RS.Open "[Update Check]", DB, adOpenDynamic
Good luck!
-
Sep 16th, 2000, 08:27 AM
#5
It still doens't work, maybe I should change the lock-type?
-
Sep 16th, 2000, 01:19 PM
#6
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|