There are two problems in this example
1) You must be sure that DataSet is in editing mode. When you call editing method of TDBRichViewEdit, it activates editing mode automatically. But if you use viewer-style methods, you need to activate it yourself, for example by calling rv.CanChange:
Code: Select all
if rv.CanChange then begin
<make changes here>
rv.Change;
rv.Format;
end;
2) The code above modifies data in the control and informs DataSet that it was modified. But data are not saved yet, untill you call Post. So when you retrieve value of the field after modification, you receives the old value. The following code should work:
Code: Select all
procedure TXXXForm.Button1Click(Sender: TObject);;
var n : integer:
begin
n := Length(DataSet.FieldByName('RVDOC').AsString);
if rv.CanChange then begin
DoSomeChages(rv.RVData);
rv.Change;
DataSet.Post;
end;
if n = Length(DataSet.FieldByName('RVDOC').AsString) then
raise Exception.Create('Contents of the FIELD are still the same!');
end;