Article View: borland.public.delphi.database
Article #184Re: Inherit from TClientDataSet - strange problem
From: 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 --------------------------------------------------------------------------------
>
>
Technical Details
Message-ID:
<K2n0m.57452$7O1.1297@newsfe06.ams2>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!feeder.news-service.com!cyclone01.ams2.highwinds-media.com!news.highwinds-media.com!npeersf01.ams.highwinds-media.com!newsfe06.ams2.POSTED!7564ea0f!not-for-mailReferences:
<0Il0m.11084$xw7.10600@newsfe26.ams2>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!feeder.news-service.com!cyclone01.ams2.highwinds-media.com!news.highwinds-media.com!npeersf01.ams.highwinds-media.com!newsfe06.ams2.POSTED!7564ea0f!not-for-mail From: "John Molyneux" <johncmolyneux@ntlworld.com> Newsgroups: borland.public.delphi.database References: <0Il0m.11084$xw7.10600@newsfe26.ams2> Subject: Re: Inherit from TClientDataSet - strange problem Lines: 80 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5512 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-RFC2646: Format=Flowed; Response X-Antivirus: avast! (VPS 090623-0, 23/06/2009), Outbound message X-Antivirus-Status: Clean Message-ID: <K2n0m.57452$7O1.1297@newsfe06.ams2> NNTP-Posting-Host: 82.30.106.149 X-Complaints-To: http://netreport.virginmedia.com X-Trace: newsfe06.ams2 1245838634 82.30.106.149 (Wed, 24 Jun 2009 10:17:14 UTC) NNTP-Posting-Date: Wed, 24 Jun 2009 10:17:14 UTC Organization: virginmedia.com Date: Wed, 24 Jun 2009 11:17:13 +0100