如何用ASP在SQL中添加数据?
<!--includefilt="conn.asp"--><%ifrequest.form("user")<>""thenonerrorresumenext'设置错误陷阱...
<!--include filt="conn.asp"-->
<%
if request.form("user")<>"" then
on error resume next '设置错误陷阱
userid=request.form("user")
pwd=request.form("psw")
sql="insert into tab_manager(userid,pwd) VALUES('"&userid&"','"&pwd&"')"
conn.execute(sql)
if err then
response.write"数据保存失败~!"
response.end()
else
response.write"数据保存成功~!"
response.end()
end if
end if
%>
<html>
<head>
<title>注册页面1</title>
</head>
<body>
<form name="form1" method="post" action="zhuce1.asp">
账号:<input name="user" type="text" size=15><br>
密码:<input name="psw" type="password" size=15><br>
<input type="submit" value="提交"><input type="reset" name="submit1" value="重置">
</form>
</body>
</html>
代码如上。但是总是添加不了数据~!
请帮帮忙~! 展开
<%
if request.form("user")<>"" then
on error resume next '设置错误陷阱
userid=request.form("user")
pwd=request.form("psw")
sql="insert into tab_manager(userid,pwd) VALUES('"&userid&"','"&pwd&"')"
conn.execute(sql)
if err then
response.write"数据保存失败~!"
response.end()
else
response.write"数据保存成功~!"
response.end()
end if
end if
%>
<html>
<head>
<title>注册页面1</title>
</head>
<body>
<form name="form1" method="post" action="zhuce1.asp">
账号:<input name="user" type="text" size=15><br>
密码:<input name="psw" type="password" size=15><br>
<input type="submit" value="提交"><input type="reset" name="submit1" value="重置">
</form>
</body>
</html>
代码如上。但是总是添加不了数据~!
请帮帮忙~! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询