Hello everyone, this post will be a bit lengthy, so please bear with me. I've been programming asp.net for abou 2 years. I'm not a master by any means, and I do things like I learn from books. Here is my standard way of connection to my mssql database (which is on the same server as my site, so I just use "localhost")
Dim objConnection As New SqlConnection(Application("dbstring"))
Dim strSQL As String = "SELECT * FROM myTable WHERE this='that'"
Dim objCommand As New SqlCommand(strSQL, objConnection)
Dim objDataReader As SqlDataReader
objConnection.Open()
objDataReader = objCommand.ExecuteReader()
Do While objDataReader.Read() = True
'Do what I need to do with the data
Loop
objDataReader.Close()
objConnection.Close()
objConnection.Dispose()
Here's my issue. Our website gets this error 2-4 and as many as 6 or 7 times a day:
General network error. Check your network documentation.
Line ###: objConnection.Open()
I use the method I wrote above for getting data on almost every page in the site. Its a HUGE site, but I've made sure that I close all my connections. This is my global connection string:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("dbstring") = "Server= Timeout=300;Connection Reset=False;Pooling=False;Max Pool Size=75000;"
End Sub
Here's my web.config file:
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
...
This server has only one website running on it, its a dedicated server. Is there something in my code causing this error to happen so much? We have to restart the sql server everytime this error happens for it to go away. Its very disruptive to the website.
Dim objConnection As New SqlConnection(Application("dbstring"))
Dim strSQL As String = "SELECT * FROM myTable WHERE this='that'"
Dim objCommand As New SqlCommand(strSQL, objConnection)
Dim objDataReader As SqlDataReader
objConnection.Open()
objDataReader = objCommand.ExecuteReader()
Do While objDataReader.Read() = True
'Do what I need to do with the data
Loop
objDataReader.Close()
objConnection.Close()
objConnection.Dispose()
Here's my issue. Our website gets this error 2-4 and as many as 6 or 7 times a day:
General network error. Check your network documentation.
Line ###: objConnection.Open()
I use the method I wrote above for getting data on almost every page in the site. Its a HUGE site, but I've made sure that I close all my connections. This is my global connection string:
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
Application("dbstring") = "Server= Timeout=300;Connection Reset=False;Pooling=False;Max Pool Size=75000;"
End Sub
Here's my web.config file:
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
...
This server has only one website running on it, its a dedicated server. Is there something in my code causing this error to happen so much? We have to restart the sql server everytime this error happens for it to go away. Its very disruptive to the website.