Good afternoon,
We have previously developed an app in-house using a local PC within the warehouse as a SQL server.
In the past week our corporate IT spun up an instance of Windows Server 2008 R2 for us, and we moved our SQL Server Express instance to that box. The physical location is no longer maintained on the network within our own building, but in our corporate HQ 5 miles up the road.
Two or three times a day we are seeing network disruptions, which are causing our SQL queries to hang. We're receiving no errors within our VB code... we updated our error traps to be wide open, but it's catching nothing... there's just no results being returned.
Does anybody know how to handle these types of errors, so we can recover naturally? It's strange that when we were on our internal network, any internal disruption did fire off our error traps, and we could recover programmatically, but on the off-site server we get nothing...
The "core" SQL process is detailed below...
Thank you very much for your help !
-Bert
Public Function GetSqlServer(cmd As String, Timeout As Integer) As Object
Try
Dim da As New SqlClient.SqlDataAdapter
Dim dc As New SqlClient.SqlCommand
Dim dc2 As New SqlClient.SqlConnection
Dim s As Object = Commandstring
Dim s2 As String = s
dc2.ConnectionString = s2
dc.CommandText = cmd
dc.Connection = dc2
dc.CommandTimeout = Timeout
da.SelectCommand = dc
Dim ds As New DataSet
da.Fill(ds)
dc2.Close()
Return ds
Catch ex As Exception
Return ex
End Try
End Function