Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Inherit from TClientDataSet - strange problem

34 views
Skip to first unread message

John Molyneux

unread,
Jun 24, 2009, 4:44:43 AM6/24/09
to
Hi.

I'm trying to use a TClientDataSet as a native type for transporting data
around a bunch of network applications, purely because the SaveToStream and
LoadFromStream are A LOT faster than KbmMemTable's similar methods, but I'm
having a bizarre problem.

I'm creating a new class, inherited from TClientDataSet, so that I can add
an extra couple of properties and methods, and this is causing a problem.

If you create a new console app and paste the code below into it, you'll see
my issue.

Can anyone (please!!!) advise me on how to resolve this rather strange
problem??

Thanks in advance,

John.


// Start of
application --------------------------------------------------------------------------------

program ClientDataSetDates;

{$APPTYPE CONSOLE}

uses
DBClient,
DB;

type
TMyClientDataSet = class(TClientDataSet)
end;

var
ClientDataSet: TClientDataSet;
MyClientDataSet: TMyClientDataSet;
begin
ClientDataSet := TClientDataSet.Create(nil);

ClientDataSet.FieldDefs.Add('Field1', ftDateTime);
ClientDataSet.CreateDataSet;

ClientDataSet.Append;
ClientDataSet.FieldByName('Field1').Value := '5/11/1955 11:30:15';
ClientDataSet.Post;

MyClientDataSet := TMyClientDataSet.Create(nil);
MyClientDataSet.Data := ClientDataSet.Data;
MyClientDataSet.First;

Writeln('ClientDataSet : ' +
ClientDataSet.FieldByName('Field1').AsString);
Writeln('MyClientDataSet : ' +
MyClientDataSet.FieldByName('Field1').AsString);

Writeln('');
Writeln('Press enter to exit');
Readln;
end.

// End of
application --------------------------------------------------------------------------------


John Molyneux

unread,
Jun 24, 2009, 6:17:13 AM6/24/09
to
Just an extra note on this problem.

I've saved both ClientDataSet and MyClientDataSet as XML, and they are
identical. It appears that the problem occurs when doing Field.Value (or
Field.AsDateTime, Field.AsString, Field.AsFloat etc. on the ftDateTime
field).

Still gagging for some help with this ridiculous problem!

"John Molyneux" <johncm...@ntlworld.com> wrote in message
news:0Il0m.11084$xw7....@newsfe26.ams2...

0 new messages