Restoring SQL Server database using ADODB retained the database restoring state
I'm restoring a database using ASP code (ADODB). The .bak file is in local system. The SQL is local with SQL Authentication.
If I tried the Restore Query in SSMS the restore successful. But the same query in ASP code is not successful. The db will be in Restoring... state.
The Query is
RESTORE DATABASE [myDB] FROM DISK = N'D:\DB\myDB_20120611_190339.bak' WITH FILE = 1, MOVE N'myDB' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.WEB2K8\MSSQL\DATA\myDB.mdf', MOVE N'myDB_log' TO N'C:\Program Files\Microsoft SQL Server\MSSQL10.WEB2K8\MSSQL\DATA\myDB_1.ldf', NOUNLOAD, REPLACE, STATS = 10 GO
I dont know whats the issue.
Any help would be appreciated.
You need to use the WITH RECOVERY option, with your database RESTORE command, to bring your database online as part of the restore process.