DB Access + TRichView
Posted: Mon Jan 01, 2007 6:58 pm
Hi, Sergey. Her is the problem. I use Access to save the RVF files. I`ve a field of type MEMO. But when I load a data from this fiel nothing is going on. Her is the code:
To Save:
main.bufer.SQL.Text := 'update documents set content="" where id_doc=1' ;
main.bufer.ExecSQL ;
ADOTable1.TableName := 'documents' ;
ADOTable1.Open ;
ADOTable1.First ;
ADOTable1.Edit ;
Stream := ADOTable1.CreateBlobStream(ADOTable1.FieldByName('content'), bmWrite);
try
RichViewEdit1.SaveRVFToStream(Stream, false);
finally
Stream.Free;
end;
ADOTable1.Post;
To Load:
ADOTable1.TableName := 'documents' ;
ADOTable1.Open ;
ADOTable1.First ;
Stream := ADOTable1.CreateBlobStream(ADOTable1.FieldByName('content'), bmRead);
try
RichView1.LoadRTFFromStream(Stream);
RichView1.Format;
finally
Stream.Free;
end;
To Save:
main.bufer.SQL.Text := 'update documents set content="" where id_doc=1' ;
main.bufer.ExecSQL ;
ADOTable1.TableName := 'documents' ;
ADOTable1.Open ;
ADOTable1.First ;
ADOTable1.Edit ;
Stream := ADOTable1.CreateBlobStream(ADOTable1.FieldByName('content'), bmWrite);
try
RichViewEdit1.SaveRVFToStream(Stream, false);
finally
Stream.Free;
end;
ADOTable1.Post;
To Load:
ADOTable1.TableName := 'documents' ;
ADOTable1.Open ;
ADOTable1.First ;
Stream := ADOTable1.CreateBlobStream(ADOTable1.FieldByName('content'), bmRead);
try
RichView1.LoadRTFFromStream(Stream);
RichView1.Format;
finally
Stream.Free;
end;