It has some random number in it, which is what TDateTimes look like when you view their value in the debugger. But the error happens before this particular assignment is made, so I'd think that it's value would have no effect anyway. Of course, I could be wrong.
-----Original Message----- From: David Brennan [mailto:[EMAIL PROTECTED]] Sent: Thursday, 23 January 2003 10:51 a.m. To: Multiple recipients of list delphi Subject: RE: [DUG]: Client Data Set error Allan, I'm guessing but is your firstPeriodDate variable a variant? If so then I suspect it has a string in it. When your line number 4 runs it tries to convert this string to a DateTime and is failing (presumably because it is an invalid date format). Check what firstPeriodDate is, perhaps try converting it to a DateTime variable first. David. > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On > Behalf Of Allan, Samuel > Sent: Thursday, 23 January 2003 10:33 AM > To: Multiple recipients of list delphi > Subject: [DUG]: Client Data Set error > > > 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/