Saving memo fields
Posted: Fri 08 Jul 2005 16:15
I have a SQL table containing among other fields, two memo fields. I am saving records using ApplyUpdates, calling a stored procedure. I determine the old or new value of a field using the following logic:
function DeltaValueStr(DeltaDS: TDataSet; FieldName: String): Variant;
begin
with DeltaDS as TCustomClientDataSet do
begin
Result := DeltaDS.FindField(FieldName).NewValue;
if VarIsEmpty(Result) then
Result := DeltaDS.FindField(FieldName).OldValue;
if Result = Null then
Result := '';
end;
end;
I have to pass a value in the stored procedure regardless, so this gives me a new value or the old value based on whether anything has changed or not. No problem with regular text fields, however, with the memo fields, if no change was made, the old value always is coming over as blank. Why?
function DeltaValueStr(DeltaDS: TDataSet; FieldName: String): Variant;
begin
with DeltaDS as TCustomClientDataSet do
begin
Result := DeltaDS.FindField(FieldName).NewValue;
if VarIsEmpty(Result) then
Result := DeltaDS.FindField(FieldName).OldValue;
if Result = Null then
Result := '';
end;
end;
I have to pass a value in the stored procedure regardless, so this gives me a new value or the old value based on whether anything has changed or not. No problem with regular text fields, however, with the memo fields, if no change was made, the old value always is coming over as blank. Why?