[Lazarus] File encoding changing silently

Gabor Boros gaborboros at yahoo.com
Tue Jan 6 13:03:25 CET 2009


Under test case creation indentified the Append problem.
I used Edit; after Append; and when removed the Edit; the record 
inserted properly to the  DataSet. Below example works.
But if put the MemDataset to the form set name to DSet add a field with 
the object inspector set name to NAME, set type to ftString and size to 
20. Remove the first 2 lines after begin (.Create and .FieldDefs.Addd) 
the result (dset.txt) contains only the header. With dynamic creation 
the file contains the 2 records.

procedure DSet_Test;
var
   DSet:TMemDataset;

begin
   DSet:=TMemDataset.Create(Self);
   DSet.FieldDefs.Add('NAME',ftString,20);
   DSet.CreateTable;
   DSet.Open;

   DSet.Append;
   DSet.FieldByName('NAME').Value:='aaa';
   DSet.Post;

   DSet.Append;
   DSet.FieldByName('NAME').Value:='bbb';
   DSet.Post;

   DSet.SaveToFile('c:\dset.txt');

   DSet.Close;
end;

Gabor

Joost van der Sluis írta:
> Op maandag 05-01-2009 om 16:50 uur [tijdzone +0100], schreef Gabor
> Boros:
>> Provide an example for what? I don't understand you.
> 
> An example application which uses TMemDataset and apply/post/etc that does not work.
> 
> Joost.
> 
> 
> _______________________________________________
> Lazarus mailing list
> Lazarus at lazarus.freepascal.org
> http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
> 




More information about the Lazarus mailing list