Mayur  Gujrathi

Mayur Gujrathi

  • 409
  • 3.9k
  • 1m

Error in database connection in classic asp

Mar 1 2013 8:42 AM

Error

Operation is not allowed when the object is closed.


<%@LANGUAGE="VBSCRIPT"  aspcompat=true%>
<%
If request("submit") <> "" Then
    Dim connectionstr1, rs, Sql,newcon

    Connectionstr1 = "Provider=SQLOLEDB.1;Password=d@45678;Persist Security Info=True;User ID=Mallik;Initial Catalog=buildshopping;Data Source=BD-SRV\MSSQLSERVER2008"
     newcon = server.createObject("ADODB.connection")

    newcon.open(connectionstr1)

    Sql = "sp_Check_Login_New_Rights '" & UCase(Request.Form("txtEmailID")) & "', '" & Request.Form("txtPassword") & "' "

    rs = Server.CreateObject("ADODB.RecordSet")
   
  
    rs.open(sql,newcon)

    If Not rs.Eof Then 'I am getting error here
    %>
    <script language="javascript">
        window.opener = 'x'
        window.open('', '_parent', '');
        window.close();
        window.open('asp2.asp', '', 'toolbar=no,directories=no,location=no,status=yes,menubar=no,resizable=yes,scrollbars=no,left=0,top=0,width=' + (screen.availwidth - 10) + ',height=' + (screen.availHeight - 50));
    </script>
    <%
    Else
      
        Response.write ("Invalid User ID Password")
    End if
    newcon.Close
End If

%>

Answers (2)