SQL Server restore database timeout error

  • Thread starter Thread starter noor
  • Start date Start date
N

noor

Hi, All
I connect to a MS SQL Server 2000 with SqlConnection (ADO.NET & C#) with
this connection string.
Server=SUN; Database=master; User ID=sa; Password=test; Connect
Timeout=1000;

And Submit these statements.

1- ALTER DATABASE [MyDB] SET SINGLE_USER WITH ROLLBACK IMMEDIATE

2- RESTORE DATABASE [MyDB] FROM DISK='c:\backup\mydb.bak' WITH RECOVERY

3- ALTER DATABASE [MyDB] SET MULTI_USER

I get this error message.

Timeout expired. the timeout period elapsed prior to completion of the
operation or the server is not responding.

And database set to "Loading" state and can not connect to it.
After this, When I restore Database with SQL Server Enterprise Manager ,All
is Ok.

Why I get this error with ADO.NET.

Thanks.
 
Try CommandTimeout..

----- noor wrote: ----

Hi, Al
I connect to a MS SQL Server 2000 with SqlConnection (ADO.NET & C#) wit
this connection string
Server=SUN; Database=master; User ID=sa; Password=test; Connec
Timeout=1000

And Submit these statements

1- ALTER DATABASE [MyDB] SET SINGLE_USER WITH ROLLBACK IMMEDIAT

2- RESTORE DATABASE [MyDB] FROM DISK='c:\backup\mydb.bak' WITH RECOVER

3- ALTER DATABASE [MyDB] SET MULTI_USE

I get this error message

Timeout expired. the timeout period elapsed prior to completion of th
operation or the server is not responding

And database set to "Loading" state and can not connect to it
After this, When I restore Database with SQL Server Enterprise Manager ,Al
is Ok

Why I get this error with ADO.NET

Thanks
 
Back
Top