asp中对象关闭时,不允许操作的问题
<%var username="dddd";
%>
<%
var conn1=Server.CreateObject("ADODB.Connection");
conn1.Provider="Microsoft.Jet.OLEDB.4.0";
conn1.Open(Server.MapPath("mickey.mdb"));
var rs1=Server.CreateObject("ADODB.Recordset");
var sql ="select * from counttable where username='"+username+"'";
rs1.Open(sql,conn1,1,3);
%>
<%
if(rs1.EOF!=true)
//if(rs1.EOF!=true&&rs1.BOF!=true)
{
var hit=Number(rs1.fields(1)+1);
sq2="update counttable set hit="+hit+" where username='"+username+"'";
}
else
{
sq2="insert into counttable values('"+username+"',1,1,1,Date())";
}
var rs2=Server.CreateObject("ADODB.Recordset");
rs2.Open(sq2,conn1);
//rs2.Update();
%>
<%
Response.write("sdsad");
rs1.Close();
rs1=null;
rs2.Close(); //加上这两句的时候就会提示:ADODB.Recordset (0x800A0E78)
rs2=null; //对象关闭时,不允许操作
conn1=null;
%>
当关闭第二个打开的Recordset对象即加上rs2.Close(),rs2=null;两句的时候就会提示:ADODB.Recordset (0x800A0E78)对象关闭时,不允许操作?不加rs2.Close(),rs2=null的时候就正确,这是为什么?