I have a real head scratcher here. Some of the RichViews that I have on a screen cause an error when being saved, others do not. The problem occurswhen saving to database (using ADO). Here is the code I use to save off to the DB field:
function SaveRVFToField(rv: TCustomRichView; tbl: TadoTable;
const FieldName: String): Boolean;
var Stream: TStream;
begin
Stream := tbl.CreateBlobStream(tbl.FieldByName(FieldName), bmWrite);
try
Result := rv.SaveRVFToStream(Stream, False);
finally
Stream.Free;
end;
end;
In the RichViews that do not cause the problem, the stream that is created always has a size of over 600 char - even when the field is NULL. In the RichViews that do cause the error, the stream that is created has a size of 0. I have looked at both sets of RichViews (those that work and those that do not) and see no differences in properties. Likewise, both types have RVStyle objects and those appear to be the same also.
In a nutshell, why does the stream sometimes have lots of characters and other times none? Might there be an initialization that goes to some and not others? When a RichView field is created, are the styles automatically set, or does the field need to be used first?
Thanks
jamie
Erratic save to DB when field is empty
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: