Insert record error

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
mvniekerk
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 11.12.2005, 19:13

Insert record error

Post by mvniekerk »

The code is trying to insert a record with the TZQuery.InsertRecord procedure into a blob field.
There is a TZQuery datActions.sqlList.
sqlList already has a blob field set up sqlListDescription (TMemoField);
I'm using a pointer T to point to the sqlList TQuery and Q to link to the TMemofield, and MS as a memorystream to read the text from a tstrings strings list Description.


procedure Save;
var
ID : Integer;
Name : String;
Number : Integer;
Description : TStrings;
Done : Boolean;
DateStarted, DateEnded : String;
Photos : TPAPhotoGroup;
I : Integer;
T : TZQuery;
Q : TMemoField;
MS : TMemoryStream;
begin
Description := TStringList.Create;
MS := TMemoryStream.Create;
T := datActions.sqlList;
Q := datActions.sqlListDescription;
T.Active := False;
T.SQL.Add('select * from `actionlist` limit 0');
T.Active := True;
Description.SaveToStream(MS);
Q.LoadFromStream(MS);
T.InsertRecord([ID, Number, Name, MS, 1, DateStarted, DateEnded, Photos.GiveID]);
MS.Free;
Q.Free;
Description.Free;
end;

Now, the thing gives an error "Cannot modify a read-only dataset". This is the same error what it gives if I use a TZTable. In the object inspector there is a read-only setting but there is nothing to change it. Trying to change it to readonly := True in the code there is no ReadOnly setting to be changed.
I'm confused. Please help me, this is sort of a December project and it needs some closing. Otherwise, please show me how to insert a record with a blob or text.

Thank you in advance!

PS. I'm using Delphi 7 with the newest CVS binaries downloadable from sourceforge.net. Thank you!
zippo
Silver Boarder
Silver Boarder
Posts: 322
Joined: 12.10.2005, 18:01
Location: Slovenia

Post by zippo »

T.RequestLive := true or
T.ReadOnly := false

(depends on the version of Zeos - see one existing TZQuery component.)
Post Reply