ASP中缺少对象: '' 请教高人!

来源:百度知道 编辑:UC知道 时间:2024/06/27 14:28:09
Microsoft VBScript 运行时错误 (0x800A01A8)
缺少对象: ''
/yuangongguanli/addyuangong.asp, 第 18 行

最后一行是18行:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%response.codepage=936%>
<!--#include file="../include/Sconn.asp "-->
<%
xkh=request.form("xkh")
if xkh<>""then
sql="Select * from [yuangongziliao] where name='"&name&"'"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
response.write "<script language='javascript'>"
response.write "alert('该员工已存在!');"
response.write "history.back(1);"
response.write "</script>"
response.end
end if
%>
<% dim rs
if rs.bof and rs.eof then
if xkh<>""then 这句的意思应该是当xkh不等于空时则如何吧, weah20201 说的能不能在详细一些!谢谢!
还是同样

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%response.codepage=936%>
<!--#include file="../include/Sconn.asp "-->
<%
set rs=server.createobject("adodb.recordset")
xkh=request.form("xkh")
if xkh<>""then
sql="Select * from [yuangongziliao] where name='"&name&"'"
rs.open sql,conn,1,1
response.redirect request.servervariables("HTTP_REFERER")
end if
%>
<% dim rs
if rs.bof and rs.eof then

--------------

你的错误:

1.rs对象创建在了if内,如果if不成立,rs就不存在了.
2.错误使用 response.end ,如果if成立,页面被中指,而不会执行js脚本.

if xkh<>""then
sql="Select * from [yuangongziliao] where name='"&name&"'"
set rs=server.createobject("adodb.recordset")
你写的这几句逻辑上有问题,在xkh为空的时候就没有RS了,那么下面当然回包错了
上面的代码给你该好了,我只是补充说明一下
你这