Exclusive access problem - SQL DB Delphi Restore funciton


2004-06-17 05:59:18 PM
delphi31
Hi,
I am trying to restore an sql database through a delphi application
using
ADO. Here is my code :
ADOConnection1.Execute('RESTORE DATABASE TEST FROM DISK =
'''+aFileName+'''');
When this executes I get the following error :
"Exclusive access could not be obtained because the database is in
use."
I have tried to set the mode of the ADO connection component to
cmShareExclusive. But this does not help.
Any help on solving this or finding another way of restoring the DB
through
delphi will be appreciated.
Thanks in advance