I don't think the Text parameter is initialised with the value of the field.  Try something like this:
 
procedure TfEMailOptions.DecryptPassword(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
    inherited;
    Text := DecryptString(Sender.AsString);
end;
 
Hope that helps,
 
Guy Brown
TimeMaster Systems
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Stacey Verner
Sent: Sunday, 12 November 2000 9:16 a.m.
To: Multiple recipients of list delphi
Subject: [DUG]: Encrypting a Password in OnSetText, and OnGetText.

I have a database field, that contains an encrypted password. I want to do something like the following to decrypt the string when I read it from the dataset,and encrypt it when writing to the dataset, but this doesn't work. I type in the string. Press save and it comes up blank.
 
procedure TfEMailOptions.DecryptPassword(Sender: TField;
var Text: String; DisplayText: Boolean);
begin
    inherited;
    Text := DecryptString(Text);
end;
 
procedure TfEMailOptions.EncryptPassword(Sender: TField;
        const Text: String);
begin
    inherited;
    Sender.AsString := EncryptString(Text);
end;
 
Any suggestions?
 
Thanks
 
Stacey
 
Stacey Verner             Ph:   +64-9-4154790
Software Developer        Fax:  +64-9-4154791
                          DDI:  +64-9-4154797
CJN Technologies Ltd.     Email: [EMAIL PROTECTED]
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/
 
 

Reply via email to