I've designed a pretty simple program that allows a user to input information on an existing service ticket. The program briefly connects to a SQL database and pulls one piece of information (The customer who opened the ticket) and uses that information to dictate what pieces of information are required for that specific customer. When the app was in BETA testing, I had no issues connecting and pulling the data. However, recently several users have reported getting timeout errors and 'named pipes provider Error 40, could not open up a connection to SQL Server' when connecting to the database. Here is the code:
The timeout problem does not occur with every user of the program, but when it does occur, restarting their computer is the only thing that seems to have an effect (although sometimes that does not even help). I've managed to get it to occur on my computer once, and was able to run it through some debugging. The program fails right on the
command.
The weird thing about it is that I am able to successfully run a command through osql via the command prompt when the problem is occurring.
I've tried several different connection strings and modifying the code slightly, but I'm fairly confident its not the code because it is an intermittent issue. I've looked up both the timeout error and the error 40, and tried several adjustments on the user's computers, including tweaking port settings on windows firewall, but to no avail. Any thoughts on this?
VB.NET:
Dim strconnection As String = "Data Source={mydatabase};Initial Catalog={mycatalog};Integrated Security=SSPI;"
Dim cn As SqlConnection = New SqlConnection(strconnection)
cn.Open()
Dim strSelect As String = "select entityname from event p inner join entity s on p.groupassigned = s.entityinternalid where eventinternalid = '" + TextBox12.Text + "'"
Dim dscmd As New SqlDataAdapter(strSelect, cn)
Dim ds As New DataSet()
dscmd.Fill(ds, "entityname")
cn.Close()
Dim dt As DataTable = ds.Tables.Item("entityname")
Dim rowCustomer As DataRow
For Each rowCustomer In dt.Rows
LinkLabel1.Text = rowCustomer.Item("entityname")
Next
If dt.Rows.Count = 0 Then
MsgBox("This Event ID does not Exist!", MsgBoxStyle.Critical, "SolvClose v2.0")
TextBox12.Text = ""
End If
The timeout problem does not occur with every user of the program, but when it does occur, restarting their computer is the only thing that seems to have an effect (although sometimes that does not even help). I've managed to get it to occur on my computer once, and was able to run it through some debugging. The program fails right on the
VB.NET:
cn.open()
The weird thing about it is that I am able to successfully run a command through osql via the command prompt when the problem is occurring.
I've tried several different connection strings and modifying the code slightly, but I'm fairly confident its not the code because it is an intermittent issue. I've looked up both the timeout error and the error 40, and tried several adjustments on the user's computers, including tweaking port settings on windows firewall, but to no avail. Any thoughts on this?