У меня есть проблема с доступом к хранимой процедуре через ASP из базы данных SQL. Это мой код для записей:Работа с хранимой процедурой ASP не допускается, когда объект закрыт
Dim com_AntwoordenPerVraag__mem_id
com_AntwoordenPerVraag__mem_id = "0"
If Session("MM_MemberID") <> "" Then
com_AntwoordenPerVraag__mem_id = Session("MM_MemberID")
End If
Dim com_AntwoordenPerVraag__cat_id
com_AntwoordenPerVraag__cat_id = "0"
If Request.QueryString("cat_id") <> "" Then
com_AntwoordenPerVraag__cat_id = Request.QueryString("cat_id")
End If
set com_AntwoordenPerVraag = Server.CreateObject("ADODB.Command")
com_AntwoordenPerVraag.ActiveConnection = MM_modular_STRING
com_AntwoordenPerVraag.CommandText = "dbo.spAantal_antwoorden_per_vraag_per_member"
com_AntwoordenPerVraag.Parameters.Append com_AntwoordenPerVraag.CreateParameter("@RETURN_VALUE", 3, 4)
com_AntwoordenPerVraag.Parameters.Append com_AntwoordenPerVraag.CreateParameter("@mem_id", 3, 1,2,com_AntwoordenPerVraag__mem_id)
com_AntwoordenPerVraag.Parameters.Append com_AntwoordenPerVraag.CreateParameter("@cat_id", 3, 1,2,com_AntwoordenPerVraag__cat_id)
com_AntwoordenPerVraag.CommandType = 4
com_AntwoordenPerVraag.CommandTimeout = 0
com_AntwoordenPerVraag.Prepared = true
set rs_AntwoordenPerVraag = com_AntwoordenPerVraag.Execute
rs_AntwoordenPerVraag_numRows = 0
Я получаю следующее сообщение об ошибке:
ADODB.Recordset error '800a0e78'
Operation is not allowed when the object is closed.
Я получаю сообщение здесь:
If rs_AntwoordenPerVraag.EOF And rs_AntwoordenPerVraag.BOF Then
EDIT
я нашел решение.
После:
set rs_AntwoordenPerVraag = com_AntwoordenPerVraag.Execute
я поставил:
If rs_AntwoordenPerVraag.State <> 1 Then
While rs_AntwoordenPerVraag.State <> 1
Set rs_AntwoordenPerVraag = rs_AntwoordenPerVraag.NextRecordset
Wend
End If
И теперь он работает :-)
Спасибо, Джонатан! – jaczjill