Hi,
Quite new to SQL Server, but I am experiecing some problems regarding closing connections and application pooling. I am developing a site and I have it working on my own machine Windows XP, SQL Server 2000 on IIS 5.0. The hosting company that I am using are using IIS 6, a windows 2003 server.
I am getting the following error "Service Unavailable" and I have been notified by the server administrator
"It appears that you application pool has stopped because of repeated failures caused by your code. This can occur when you are not closing connections. I suggest downloading your site and running it on a windows 2003 development server with application pools to test whether you can find the fault."
I have gone over all my code and ensured that all connection are closed but my question is this:
If I open a connection, and a record set, do some actions with the record set and then close the connection, what happens if I have a response.redirect before the connection is closed? does the connection have to be closed prior to the redirect. e.g.:
Dim objConn
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.ConnectionString = "DSN=Northwind"
objConn.Open
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "SELECT * FROM Table1", objConn
If rs.eof then
response.redirect ("home.asp?message=noresults")
Else
' do some actions with the recordset
.....
End if
objRS.Close
Set objRS = Nothing
objConn.Close
Set objConn = Nothing
_____________________
Should the objrs nad objconn close be stated before the response.redirect if there are no results? or does the server read all the code on the page even if it needs to redirect.
THanks.
I have cross posted in
http://p2p.wrox.com/forum.asp?FORUM_ID=55