Please look at the code. I'm trying to insert a record with blob data (actually a TMemoField). I get an error after the "Post' Command
T.Insert;
try
T.Edit;
MS := T.CreateBlobStream(T.FieldByName('Description'), bmWrite);
Description.SaveToStream(MS);
T.FieldValues['ID'] := ID;
T.FieldValues['Number'] := Number;
T.FieldValues['Name'] := Name;
T.FieldValues['Done'] := Done;
T.FieldValues['DateStarted'] := DateStarted;
T.FieldValues['DateEnded'] := DateEnded;
T.FieldValues['PhotoGroup'] := Photos.GiveID;
T.Post;
except
on Exception do;
end;
Any help would be welcome!
Blob data edit / add problem
Moderators: gto, cipto_kh, EgonHugeist
On reviewing I see my explanation was a bit vague.
T is a TZQuery, initiated with T.SQL.Add("Select * from `actionlist`"); T.Active := True;
Description as a variable is a TStrings variable.
The error after the "post" command was 'Cannot insert table, field 'Description' cannot by NULL'
It seems that the TStrings did not copy to the TStream, or the TStream did not update the Description field (which is a TMemoField).
T is a TZQuery, initiated with T.SQL.Add("Select * from `actionlist`"); T.Active := True;
Description as a variable is a TStrings variable.
The error after the "post" command was 'Cannot insert table, field 'Description' cannot by NULL'
It seems that the TStrings did not copy to the TStream, or the TStream did not update the Description field (which is a TMemoField).
As far as I can see: you hava a database field called "Description" and a Memo field with the same name, and you try to fill the database field with the contents of the memo field, using stream MS. But I don't see where you actually fill the database field. No T.FieldValues['Description']. So it is null.
And Tygrys is right too.
Regards,
Rüdiger
And Tygrys is right too.
Regards,
Rüdiger