Simple ASP function question

Posted by J Harley on Stack Overflow See other posts from Stack Overflow or by J Harley
Published on 2010-05-28T09:36:10Z Indexed on 2010/05/28 9:41 UTC
Read the original article Hit count: 229

Good Morning,

I have got the following function:

 FUNCTION queryDatabaseCount(sqlStr)
        SET queryDatabaseCountRecordSet = databaseConnection.Execute(sqlStr) 
        If queryDatabaseCountRecordSet.EOF Then
            queryDatabaseCountRecordSet.Close
            queryDatabaseCount = 0
        Else
            QueryArray = queryDatabaseCountRecordSet.GetRows
            queryDatabaseCountRecordSet.Close
            queryDatabaseCount = UBound(QueryArray,2) + 1
        End If
    END FUNCTION

And the following dbConnect:

SET databaseConnection = Server.CreateObject("ADODB.Connection")

    databaseConnection.Open "Provider=SQLOLEDB; Data Source ="&dataSource&"; Initial Catalog ="&initialCatalog&"; User Id ="&userID&"; Password="&password&""

But for some reason I get the following error:

ADODB.Recordset error '800a0e78'

Operation is not allowed when the object is closed.

/UBS/DBMS/includes/blocks/block_databaseoverview.asp, line 30

Does anyone have any suggestions?

Many Thanks, Joel

© Stack Overflow or respective owner

Related posts about sql-server-2005

Related posts about asp-classic