Reputation: 1839
TField.Clear does not work on a DateTime field, like it does for say an integer field. So how do I set the field to null?
I'm using Delphi 2010.
Currently I do this;
IBDataset1.FieldByName('EUL_START_DATE').Clear;
However the field does not get set to null, it still contains a date value.
I think this explains it, but i don't want to go messing with core delphi files. http://qc.embarcadero.com/wc/qcmain.aspx?d=78920
What if i need to reinstall Rad Studio. I would have to remember all these little patches.
Upvotes: 0
Views: 2288
Reputation: 1839
In the unit IBCustomDataset from line 3480 comment out the following lines;
//if TIBStringField(Field).EmptyAsNull then
// rdFields[FMappedFieldPosition[Field.FieldNo - 1]].fdIsNull := True
//else
//begin
// rdFields[FMappedFieldPosition[Field.FieldNo - 1]].fdDataLength := 0;
// rdFields[FMappedFieldPosition[Field.FieldNo - 1]].fdIsNull := False;
//end
and add in the following lines;
//NewCode IbCustomDataSet.pas Line 3480
begin
if (Field is TIBStringField) and
(not TIBStringField(Field).EmptyAsNull) then
begin
rdFields[FMappedFieldPosition[Field.FieldNo - 1]].fdDataLength := 0;
rdFields[FMappedFieldPosition[Field.FieldNo - 1]].fdIsNull := False;
end
else
rdFields[FMappedFieldPosition[Field.FieldNo - 1]].fdIsNull := True;
end
//End New Code
solution found here; http://qc.embarcadero.com/wc/qcmain.aspx?d=78920
Tested, seem to work ok.
Just remember to make a note if you need to reinstall rad studio, this patch will need to be re-applied.
Upvotes: 1