日期:2014-05-17  浏览次数:21259 次

执行查询,错误提示:对象已关闭,操作不允许。
代码如下:
<table   border= '1 '   width= "50% ">
<tr>
<td   width= "25% "> 用户名 </td>
<td   width= "25% "> 姓名 </td>
<td   width= "25% "> 密码 </td>
<td   width= "25% "> 类别 </td>
</tr>
<%
dim   strConn,strRset,Conn_Str,strSql

set   strConn   =   Server.CreateObject( "ADODB.Connection ")

Conn_Str= "Driver={SQL   Server};Server=localhost;Uid=xianghua;Pwd=xianghua;Database=status; "
strConn.open   Conn_Str

strSql= "select   *   from   Operator "
set   strRset   =   strConn.Execute   (strSql,10,1)

do   while   NOT   strRset.EOF
Response.Write   " <tr> "
Response.Write   " <td> "   &   strRset( "OperID ")   &   " </td> "
Response.Write   " <td> "   &   strRset( "OperName ")   &   " </td> "
Response.Write   " <td> "   &   strRset( "OperPassWord ")   &   " </td> "
Response.Write   " <td> "   &   strRset( "opertype ")   &   " </td> "
Response.Write   " </tr> "
strRset.MoveNext
Loop
Response.Write   " <tr> <td> <a   href=testadd.asp> 新增 </a> </td> <td> <a   href=testmod.asp> 修改 </a> </td> <td> <a   href=testdel.asp> 删除 </a> </td> <td> <a   href=testqry.asp> 查询 </a> </td> </tr> "
Response.Write   " <tr> <td   colspan=4> <font   color=red> 点击新增前要先点击删除,不然会引起主键冲突 </font> </td> </tr> "
Response.Write   " </table> "

strConn.Close
set   strConn   =   Nothing
%>

经过测试问题出在set   strRset   =   strConn.Execute   (strSql,10,1)这行
这个查询代码我在去年的时候运行都是可以的,而且现在数据库,系统和asp都没动过。但是却有以上错误,请各位帮助。谢谢

------解决方案--------------------
strConn.Execute (strSql)
这样试试
------解决方案--------------------
看看strConn有没有打开