The title pretty much says it all. I\'m using a TClientDataset to store an array of objects, and one of the objects has a member defined as a set of an enumerat
Based on the example of Andreas, but made somewhat simpler and clearer IMHO.
Tested on XE2
You could use a TBytesField or a TBlobField
ClientDataSet1MySet: TBytesField, Size=32
1) Writing
var
MySet: set of Byte;
Bytes: TBytes;
begin
MySet := [0];
// Write
Assert(ClientDataSet1Test.DataSize >= SizeOf(MySet), 'Data field is too small');
SetLength(Bytes, ClientDataSet1Test.DataSize);
Move(MySet, Bytes[0], SizeOf(MySet));
ClientDataSet1.Edit;
ClientDataSet1Test.AsBytes := Bytes;
ClientDataSet1.Post;
end;
2) Reading
var
MyResultSet: set of Byte;
begin
Move(ClientDataSet1Test.AsBytes[0], MyResultSet, ClientDataSet1Test.DataSize);
end;