function fQueryAssignVal( oQuery: TQuery; // the query
sFName: String; // field name on DB
fDataType: ftDataType, // type of field, ftstring ....
fValue: Variant // Value that will be Assigned.
); boolean;
begin
if (fDataType in [ftDate]) then
begin
if ( TDateTime(psValue) <> TDateTime(NullDate) ) then
psValue := TDate(VarToDateTime(psValue))
else psValue := Null;
if (psValue = 0) then
psValue := NULL;
//if ( VarToDateTime(psValue) <> NullDate )
// psValue:= Trunc(psValue);
end;
end;
// WHEN CALLING
// .....
fQueryAssignVal( qryPTNS, 'DateNais', ftDate, DtPicker.Date);
//....
qryPTNS.Execute;