Subject Error when assigning a value .. type conversion problem with dates in both IBO 4.9.9 and 4.9.10
Author Adrian Wreyford
Hi Jason,

Its me and the variants again.

This time I'm stumped.

I'm parsing a CSV into a Query.

The fields in the CSV are all strings, and stored in a stringlist.

I then assign these to the fileds in the query, the fieldnames also stored in a list.

IB_QueryBlup.FieldByName(BlupColList[r]).Value := FieldList.Items[r-1];

When I send the field BLUPDATE, a date field, ie the value '1988/02/05' it throws the error:

EVariantTypeCastError with message ' Could not convert variant of type (UnicodeString) into type (Double).

And occurs in: IB_Components
42510: procedure TIB_Column.SetAsVariant( const NewValue: Variant );

and especially at line: 42660-1
SQL_TYPE_DATE,
SQL_TYPE_DATE_: if AsDate <> Trunc( NewValue ) then

NewValue = '1988/02/05', and this is where the problem comes in. It appears to be expecting the data value as double, and not the date string that we are actually passing it.

Your routine should probably first check if the date value passed is a TDate, or a human readable representation of the date ie '1988/02/05'.

Hope you can help.

This is quite a problem for me at the moment.

Regards

Adrian







[Non-text portions of this message have been removed]