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

缺少对象"
代码如下:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--#include file="../Include/Const.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<center>
<br>
<table>
<tr>
<td>注册信息</td>
</tr>
<tr>
<td>
<div align="center">
<%
yhm=request.form("yhm")
mm=request.Form("mm")
qrmm=request.Form("qrmm")

%>
<%
set rs=con.execute("select adminName from admin where adminName='"&yhm&"'")
if rs.eof =false then
response.Write( "已注册")
%>
<%
else  
set rs=con.execute("insert into admin(adminname,password) value('"&yhm&"','"&mm&"')")
response.Write("恭喜注册成功")
response.Write("您的用户名:"&yhm&"<br><br>")
response.Write("您的密码:"&mm&"<br><br>")
end if
%>





  </div></td>
  </tr>
  </table>
  </center>
  </body>
  </html>
   


------解决方案--------------------
C# code
首先楼主得有这个类con。里面有execute()的方法。

------解决方案--------------------
记得:
rs.close
set rs=nothing

页面结束了还要关闭下数据库
给你个代码,放到你的<!--#include file="../Include/Const.asp"-->文件里面,每次打开了数据库记得在页尾调用下CloseCon()。特别是Access数据库,我看到打开后产生的那个文件就烦。
Sub CloseCon()
On Error Resume Next
If IsObject(Con) Then
Con.Close
Set Con = Nothing
End If
End Sub