Subject | Re: [IBO] Varchar with #0 char in it |
---|---|
Author | Helen Borrie |
Post date | 2008-03-14T20:18:38Z |
At 02:45 AM 15/03/2008, you wrote:
Does your GetEncryptedData function return a quoted string? If not, you might like to try wrapping the expression inside QuotedStr, viz.
Sender.AsString := QuotedStr(GeneralFunctions.GetEncryptedData(Text, lID, ...));
Helen
>> I'm not sure if it is pertinent, but are you referring to the fieldYou could try to disable casting entirely by using the AsRawString method instead of AsString.
>> using .Value or .AsString? The .Value method does save extra code in
>> loops but the downside is it accesses the values as variants and
>> relies on Delphi to do the casting. That does increase the risk of
>> undesired effects such as (possibly) the encounter with the ascii-
>> zero causing the string to be interpreted as null-terminated. I
>> always use the casting methods where possible...
>
>here is my code:
>
>procedure TdmDatabase.SetEncryptedFieldText(Sender: TField; const
>Text: String);
>var
> lID: Integer;
>begin
> if Sender.DataSet.FieldByName('Encrypted').AsBoolean then
> begin
> lID := ...
> if not (Sender.Dataset.State in dsEditModes) then
> Sender.Dataset.Edit;
>
> Sender.AsString := GeneralFunctions.GetEncryptedData(Text, lID, ...);
> end;
>end;
>
>any other ideas?
Does your GetEncryptedData function return a quoted string? If not, you might like to try wrapping the expression inside QuotedStr, viz.
Sender.AsString := QuotedStr(GeneralFunctions.GetEncryptedData(Text, lID, ...));
Helen