Page 1 of 1

Encrypted Sqlite: password validation on screen

Posted: Wed 23 Jan 2013 10:37
by jota
Hi

I´m using UniDAC 4.3.8

I do not know how to validate the password. Can someone help me with an example of code is needed to indicate if the entered password is correct or not?

Thanks in advance

Re: Encrypted Sqlite: password validation on screen

Posted: Wed 23 Jan 2013 13:25
by AlexP
hello,

When attempting to connect to an encrypted DB, password is validated by the library, and you cannot validate the password by yourself. You can wrap the Connect method call with a Try...Except block and analyze the codes of the occurred errors. I.e.:

Code: Select all

  UniConnection1.SpecificOptions.Values['EncryptionKey'] := 'test';
  try
    UniConnection1.Connect;
  except
    on E: EUniError do
      case E.ErrorCode of
        26: ShowMessage('Invalid Password');
        else
          ShowMessage('Other Error');
      end;
  end;
P.S. Retrieving of error code in this version is available only when working with the client library. We will add this functionality in the next build. For the time being, the following error is returned in the Direct mode:
'Invalid EncryptionKey and/or EncryptionAlgorithm specified" with no code.