I try to change a password for an existing access database but there are problems with it.
At first I tried to use command ALTER database .... but there was a problem with not recognisation of SQL syntax text (there appeared a message, saying that I can use only following commands : DELETE, INSERT, PROCEDURE, SELECT and UPDATE).
Then I find out, that in order to change password I have to have ExclusiveLock rights. I found such possibility in UniConnection>SpecificOptions>SpecificLock> and I changed this property to "True". But in this case my application hangs running out or there appeared a message, saying that there is wrong password, ... but I know, it is ok.
Which is the best and easiest way to change password for an existing access database (using UNIdac).
Thanks for ane suggestions.
Access database.
Re: Access database.
To use the SQL query "ALTER DATABASE PASSWORD ...", when working with Microsoft Access DB using UniDAC, you should use the 'ExtendedAnsiSQL' option :
Code: Select all
...
UniConnection.SpecificOptions.Values['ExtendedAnsiSQL'] := 'True';
UniConnection.SpecificOptions.Values['ExclusiveLock'] := 'True';
UniConnection.Password := 'currentpassword';
UniConnection.Connect;
UniConnection.ExecSQL('ALTER DATABASE PASSWORD newpassword currentpassword');
...
Re: Access database.
Thanx, it works ..
MaximG wrote:To use the SQL query "ALTER DATABASE PASSWORD ...", when working with Microsoft Access DB using UniDAC, you should use the 'ExtendedAnsiSQL' option :Code: Select all
... UniConnection.SpecificOptions.Values['ExtendedAnsiSQL'] := 'True'; UniConnection.SpecificOptions.Values['ExclusiveLock'] := 'True'; UniConnection.Password := 'currentpassword'; UniConnection.Connect; UniConnection.ExecSQL('ALTER DATABASE PASSWORD newpassword currentpassword'); ...
Re: Access database.
We are glad to see the problem resolved. Please don't hesitate to contact us with questions concerning UniDAC usage.