Thread View: borland.public.delphi.database
2 messages
2 total messages
Started by John Molyneux
Wed, 24 Jun 2009 08:44
Inherit from TClientDataSet - strange problem
Author: John Molyneux
Date: Wed, 24 Jun 2009 08:44
Date: Wed, 24 Jun 2009 08:44
65 lines
2936 bytes
2936 bytes
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 --------------------------------------------------------------------------------
Re: Inherit from TClientDataSet - strange problem
Author: John Molyneux
Date: Wed, 24 Jun 2009 10:17
Date: Wed, 24 Jun 2009 10:17
78 lines
3325 bytes
3325 bytes
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" <johncmolyneux@ntlworld.com> wrote in message
news:0Il0m.11084$xw7.10600@newsfe26.ams2...
> 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 --------------------------------------------------------------------------------
>
>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads