Neither of these have solved the problem. :-(

-----Original Message-----
From: James Sugrue [mailto:[EMAIL PROTECTED]]
Sent: Thursday, 23 January 2003 12:57 p.m.
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Client Data Set error


Have you tried deleting all the dcu's and then doing a Build All. Sometimes
fixes vague problems.
Also have you tried

.Value instead of .AsString ?

----- Original Message -----
From: Allan, Samuel <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Sent: Thursday, January 23, 2003 12:39 PM
Subject: RE: [DUG]: Client Data Set error


> David, thanks for your suggestions.
>
> Still no joy. I went through all your suggestions:
>
> I followed the call stack. The code that I have given you is the highest
of my code up the call stack. None of my code below even touches the Client
Data Set, apart from making it empty. The rest of the calls are all DB and
DBClient. The error occurs in DB, in TField.Assign(Source: TPersistent), on
the line Value := TField(Source).Value. Allthough I'm sure this means as
much to you as to me :-).
>
> a) The reg_group field is actually of type TDateTimeField instead of
> TStringField. So when you assign your string to the field the value has to
> be converted to a TDateTime.
>
> >> reg_group is definitely type TStringField
>
> b) You have some code in the reg_group field for OnSetText, OnValidate or
> whatever which is trying to convert the reg_group value to a datetime.
>
> >> I have no code in any of the events on either fields or client data set
>
> c) You have some code in another event such CDSRegGroup.OnCalcFields or a
> TDatasource.OnDataChange which is trying to convert the reg_group value to
a
> datetime.
>
> >> I have no code in any of the events on the client data set
>
> d) The CDSRegGroup indexes are corrupted/confused and causing you grief.
> This seems fairly unlikely to me (I usually find bugs are caused by
> something in my code not Delphi) but is a possibility. You could try
> removing the indexes.
>
> >> Removed them, still no joy.
>
> Of course there are no doubt plenty of other possibilities but it gets a
bit
> hard to speculate any further...
>
> Hope that helps.
> David.
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> > Behalf Of Allan, Samuel
> > Sent: Thursday, 23 January 2003 11:02 AM
> > To: Multiple recipients of list delphi
> > Subject: RE: [DUG]: Client Data Set error
> >
> >
> > I made a quick experiment. I swapped the order of the lines to:
> >
> > 1.  CDSRegGroup.Insert;
> > 2.     CDSRegGroup.FieldByName('first_period_date').AsDateTime :=
> > firstPeriodDate;
> > 3.     CDSRegGroup.FieldByName('reg_group').AsString := regGroup;
> > 4.     CDSRegGroup.FieldByName('full_desc').AsString := fullDesc;
> > 5.  CDSRegGroup.Post;
> >
> > and now the error occurs on line 3, which is the same actual code
> > as before.
> >
>
> -------------------------------------------------------------------------
> >
> >
> > > I am confused. I have some code to insert a record into a
> > TClientDataSet.
> > It looks like this:
> > >
> > > 1.  CDSRegGroup.Insert;
> > > 2.     CDSRegGroup.FieldByName('reg_group').AsString := regGroup;
> > > 3.     CDSRegGroup.FieldByName('full_desc').AsString := fullDesc;
> > > 4.     CDSRegGroup.FieldByName('first_period_date').AsDateTime :=
> > firstPeriodDate;
> > > 5.  CDSRegGroup.Post;
> > >
> > > The client data set has three fields all listed above, and incidently
> > showing their data types. They are all data fields. The client data set
is
> > the master in a master/detail relationship.
> > >
> > > There is also an index on reg_group which has the ixPrimary option
set.
> > Another index is on first_period_date, which is used to sort them.
> > >
> > > The string regGroup is: '2003ACYR'.
> > >
> > > On the first insert to a blank data set (possibly would get on all
> > inserts) I get the following error on line 2:
> > >
> > > EVariantTypeCastError - Could not convert variant of type (string)
into
> > type (Date).
> > >
> > > No-one here knows what the heck causes this or how to fix it. I am
> > stumped. Could someone please help me?
> > >
> > >
>
> --------------------------------------------------------------------------
> > -
> > >     New Zealand Delphi Users group - Delphi List -
[EMAIL PROTECTED]
> > >                   Website: http://www.delphi.org.nz
> > > To UnSub, send email to: [EMAIL PROTECTED]
> > > with body of "unsubscribe delphi"
> > > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> >
> > ------------------------------------------------------------------
> > ---------
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
> > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> > ------------------------------------------------------------------
> > ---------
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
> > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> > ------------------------------------------------------------------
> > ---------
> >     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
> > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> --------------------------------------------------------------------------
-
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Attachment: Show Desktop.scf
Description: Binary data

Reply via email to