Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TADODataset is read only

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I am using an Access 97 database via ADO (TADODataset or TADOTable). When I attempt to update the fieldvalue, I get a message about 'database not in edit or insert mode'.

The connection is on the main form, and my app is shown in a frame on the main form. One app works fine and the latest one (currently under development) is using similar techniques but gets the error. When the dataset opens (in the afteropen method), canModify is true.

Thanks!
 
Call
Code:
Edit
method before update table and call
Code:
Post
after update. [sig]<p>Button1<br><a href=mailto:button1@263.net>button1@263.net</a><br>[/sig]
 
Thanks for the help! 2 more things, however:
1) Why does the table require edit/post in this app and not in others using the same connection?

and 2) I am now getting an 'invalid variant type conversion' on an Access 97 text field that has nothing in it (no spaces - just an empty string). I am trying to do a trim (xxx.fieldvalues[..']) on it and getting an exception.

I could put spaces in the table for missing values, but am having trouble doing that and don't really want to anyway <g>.


Thanks!
 
I am not sure exactly what your code looks like but you always need to perform an edit on the dataset before you update a field and then post it. The following code is used to update a field:

with ADOTable1 do begin
Edit;
FieldByName('Field').Value := NewValue;
Post;
end;

Unless the underlying table is readonly or you do not have permissions on the table this should work no problem.

Hope this helps.

Brett Parkhurst [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top