Eamon
asked on
BACKUP DATABASE timeout expired.
I get this error message when I try to run my BACKUP DATABASE Strored Procedure as a command in VS 2005.
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
' Code
Dim strTempCnn As String = "user id=myUser;password=MyPassw ord;data source=MyServer;" & _
"persist security info=True;initial catalog=MyDatabase;Connect Timeout=0"
Dim TempCnn As SqlClient.SqlConnection = New SqlClient.SqlConnection(st rTempCnn)
Try
Dim cmdBU As SqlClient.SqlCommand = New SqlClient.SqlCommand
cmdBU.Connection = TempCnn
cmdBU.CommandType = CommandType.StoredProcedur e
cmdBU.CommandText = "[dbo].[BackUpDataBase]"
If TempCnn.State <> ConnectionState.Open Then
TempCnn.Open()
End If
cmdBU.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
TempCnn.Close()
End Sub
My Stored Procedure is:
BACKUP DATABASE MyDatabase
TO DISK = N'c:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Backu p\MyDataba se.Bak'
WITH FORMAT,
NAME = N'MyDatabase-Full Database Backup'
END
However when i execute the Stored Procedure in SQL Server it executes fine and completes in 55 seconds.
Also in my connection string, I have changed the connect timeout property to various amounts and still get same error message.
Any ideas?
Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
' Code
Dim strTempCnn As String = "user id=myUser;password=MyPassw
"persist security info=True;initial catalog=MyDatabase;Connect
Dim TempCnn As SqlClient.SqlConnection = New SqlClient.SqlConnection(st
Try
Dim cmdBU As SqlClient.SqlCommand = New SqlClient.SqlCommand
cmdBU.Connection = TempCnn
cmdBU.CommandType = CommandType.StoredProcedur
cmdBU.CommandText = "[dbo].[BackUpDataBase]"
If TempCnn.State <> ConnectionState.Open Then
TempCnn.Open()
End If
cmdBU.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
TempCnn.Close()
End Sub
My Stored Procedure is:
BACKUP DATABASE MyDatabase
TO DISK = N'c:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Backu
WITH FORMAT,
NAME = N'MyDatabase-Full Database Backup'
END
However when i execute the Stored Procedure in SQL Server it executes fine and completes in 55 seconds.
Also in my connection string, I have changed the connect timeout property to various amounts and still get same error message.
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Seems to run fine now.