🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.database
Article #183

Inherit from TClientDataSet - strange problem

#183
From: John Molyneux
Date: Wed, 24 Jun 2009 08:44
65 lines
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 --------------------------------------------------------------------------------
Technical Details
Message-ID: <0Il0m.11084$xw7.10600@newsfe26.ams2>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!feeder.news-service.com!feeder.news-service.com!cyclone01.ams2.highwinds-media.com!news.highwinds-media.com!npeersf01.ams.highwinds-media.com!newsfe26.ams2.POSTED!7564ea0f!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1026cfe760,925b311ad87d08c1,start
X-Google-Attributes: gid1026cfe760,public,usenet
X-Google-NewGroupId: yes
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!feeder.news-service.com!feeder.news-service.com!cyclone01.ams2.highwinds-media.com!news.highwinds-media.com!npeersf01.ams.highwinds-media.com!newsfe26.ams2.POSTED!7564ea0f!not-for-mail
From: "John Molyneux" <johncmolyneux@ntlworld.com>
Newsgroups: borland.public.delphi.database
Subject: Inherit from TClientDataSet - strange problem
Lines: 67
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; Original
X-Antivirus: avast! (VPS 090623-0, 23/06/2009), Outbound message
X-Antivirus-Status: Clean
Message-ID: <0Il0m.11084$xw7.10600@newsfe26.ams2>
NNTP-Posting-Host: 82.30.106.149
X-Complaints-To: http://netreport.virginmedia.com
X-Trace: newsfe26.ams2 1245833084 82.30.106.149 (Wed, 24 Jun 2009 08:44:44 UTC)
NNTP-Posting-Date: Wed, 24 Jun 2009 08:44:44 UTC
Organization: virginmedia.com
Date: Wed, 24 Jun 2009 09:44:43 +0100