我想从按钮上的一个.asp页打开另一个.asp页,以下是我完成的代码,但错误即将来临

出现错误,因为“关闭对象时不允许操作

这是代码

 Dim dbconn, objCmd, objParam, rs, EmailID, Password, connString, RecordCount

 connString = "Connectionstring"

 dbconn = Server.CreateObject("ADODB.Connection")

 dbconn.Open(connString)

 rs = Server.CreateObject("ADODB.RecordSet")

 objCmd = Server.CreateObject("ADODB.Command")
 objCmd.ActiveConnection = dbconn
 objCmd.CommandText = "sp_Name"
 objCmd.CommandType = &H0004
 objParam = objCmd.CreateParameter("@EmailID",200,1,"100",Session("EmailID"))
 objCmd.Parameters.Append(objParam)

  objParam = objCmd.CreateParameter("@Password",200,1,"100",Session("Password"))
  objCmd.Parameters.Append(objParam)

   rs = objCmd.Execute(Session("EmailID"),Session("Password"))

   do while not rs.eof ------->here comes error

    EmailID = rs(0)
    Password =  rs(1)
    'response.Write EmailID & "," & Password & "<br">
    rs.MoveNext
loop

最佳答案

尝试下面的代码。

SET rs = objCmd.Execute(Session("EmailID"),Session("Password"))

在rs之前添加SET

关于asp-classic - ASP中的Recordset并在ASP中执行存储过程,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15159067/

10-11 04:21