update database fails (BlobStream)

General TRichView support forum. Please post your questions here
Post Reply
jstickle
Posts: 5
Joined: Mon Feb 27, 2006 11:15 am

update database fails (BlobStream)

Post by jstickle »

I have written some code that loads a template into an editor, the template is loading fine however when I try and commit the changes to the database the changes are lost - see code below. The stream is changing size when RTF is edited so the save to stream is working correctly.
Any help gratefully received
John

mainForm.stream_read_write := imdDataModule.document_template_getStoredProc.CreateBlobStream(imdDataModule.document_template_getStoredProc.FieldByName('template'), bmReadWrite);

with document_editorForm.RichViewEdit1 do
begin
// clear current contents
Clear;
Refresh;
// reset stream.read position to start of stream - otherwise read.position at end > no data copied
mainForm.stream_read_write.position := 0;
LoadRTFFromStream(mainForm.stream_read_write);
Format;
Refresh;
end;


ShowMessage(IntToStr(mainForm.stream_read_write.size));
document_editorForm.ShowModal();

document_editorForm.RichViewEdit1.SaveRTFToStream(mainForm.stream_read_write, False);
ShowMessage(IntToStr(mainForm.stream_read_write.size));
imdDataModule.document_template_getStoredProc.Post();
jstickle
Posts: 5
Joined: Mon Feb 27, 2006 11:15 am

Post by jstickle »

I found out the solution is:


use cachedupdates and
CommitUpdates;
Post Reply