I'm getting this:
"Exclusive access could not be obtained because the database is in use. RESTORE DATABASE is terminating abnormally."
First the message told me I must connect to master db to execute the restore but I change it and I got the message above.
The parametrized sql statement I'm using is:
cmd.CommandText = "RESTORE DATABASE aguasdelbosque " + "FROM DISK = @archivo"