I'm running Classic ASP on IIS and have a script to create a connection to a SQL Server database using the following code:
Dim adoConn As Object
adoConn = Server.CreateObject("ADODB.Connection")
adoConn.Open ("Provider=SQLOLEDB; Data Source=localhost; Initial Catalog=Engineering_Test; User ID=*********; Password=*******")
I then run SQL select queries off of this connection as follows:
Dim rs As Object
rs = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT [User ID] FROM [Users] WHERE [Username]='" & username & "' AND [Password]='" & password & "'"
rs.Open(SQL, adoConn, 3, 3)
All was working fine, but then I discovered I had lots of sleeping processes on the server and it had began refusing connections because I presumably had maxed out all of the allowed connections to the server. In reality, what I saw on screen was my SQL queries returning empty recordsets when in fact they should have contained multiple rows.
So I killed all of the sleeping processes on the server, restarted SQL Server and IIS, however, the SQL queries I am executing are still returning empty recordsets, no errors are displayed and everything compiles as expected.
When I login to the server using remote desktop and execute the exact same queries in SQL Server Management Studio (accessed via the same user credentials) the queries return complete recordsets.
Is there anything else I can do/check to resolved this issue? It is truly baffling me!
SET NOCOUNT ON;
help? – Martin Smith