Page 1 of 1

update database fails (BlobStream)

Posted: Mon Feb 27, 2006 11:41 am
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();

Posted: Mon Feb 27, 2006 1:41 pm
by jstickle
I found out the solution is:


use cachedupdates and
CommitUpdates;