I have to increase timeout period.Following is my code.
Private Function GetConnectionInstance() As SqlConnection
Dim objConn As SqlConnection
Dim strConnection As String
strConnection = ConfigurationSettings.AppSettings("conn")
Try
objConn = New SqlConnection(strConnection)
Catch ex As Exception
End Try
Return objConn
End Function
What code i have to add in above to increase timeout period.
You need to add the next item into your connection string:
Connection Timeout=30;
If you need to change Timeout only for target connection, not in the whole application, do next:
Dim connString as String = ConfigurationSettings.AppSettings("conn")
Dim builder As New SqlConnectionStringBuilder(connString)
builder.ConnectTimeout = 30;
Dim connection = New SqlConnection(builder.ToString())
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With