28,391
社区成员
发帖
与我相关
我的任务
分享
<%@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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<p>
<label>用户名:
<input type="text" name="yhm" />
</label>
<br />
<label>密码:
<input name="mima" type="text"/>
</label>
<br />
<input type="submit" name="submit" value="提交" />
<input type="reset" name="submit2" value="重置" />
</p>
</form>
<%
set conn=server.CreateObject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};dbq="&server.MapPath("data/nod32.mdb")
%>
<%
yhm=request.Form("yhm")
mima=request.Form("mima")
conn.execute("INSERT INTO id(yhm,mima) VALUES ('"+yhm+"','"+mima+"')")
exec="select * from id where date=date()"
set rs=server.CreateObject("adodb.recordset")
rs.open exec,conn,3,1
%>
<%do while not rs.eof%>
<%=rs("yhm")%><br>
<%=rs("mima")%><br>
<%=rs("date")%><br>
<%
rs.movenext
loop
%>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>
<%
yhm=request.Form("yhm")
mima=request.Form("mima")
conn.execute("INSERT INTO id(yhm,mima) VALUES ('"+yhm+"','"+mima+"')")
exec="select * from id where date=date()"
set rs=server.CreateObject("adodb.recordset")
rs.open exec,conn,3,1
%>
这段话是没有条件限制就可以执行的。给个条件去限制就行。如:提交之后才执行。检测提交变量后才执行。