程序执行没有报错,但是数据没有写进数据库里
<!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=gb2312" />
<title>无标题文档</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="add.asp">
<label>
<input type="text" name="id" />
</label>
<label>
<input type="text" name="password" />
</label>
<label>
<input type="submit" name="Submit" value="提交" />
</label>
<label>
<input type="reset" name="Submit2" value="重置" />
</label>
</form>
</body>
</html>
下面是 add.asp文件
<!--#include file="dbpath.asp"-->
<% dim name
dim pass
name=request.from("ID")
pass=request.from("password")
savedata()
response.redirect "index.asp"
set rs=nothing
conn.close
set conn=nothing
sub savedata()
dim insertcursor
set insertcursor = server.createobject("adodb.recordset")
insertcursor.open "select * from addnews",conn,1,3
insertcursor.addnew
insertcurrsor("username")=name
insertcurrsor("password")=pass
insertcurrsor.update
insertcurrsor.close
conn.close
set insertcursor=nothing
end sub
%>
数据库连接文件 dbpath.asp
<%
dim conn
dim connstr
on error resume next
connstr="DBQ="+server.mappath("add.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>