asp表单数据为什么提交不到数据库里
积分兑换页<!--#includefile="inc/conn.asp"--><!--#includefile="inc/config.asp"--><!--#inclu...
积分兑换页
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="inc/Function.asp"-->
<html><head><title>积分兑换</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="5" marginwidth="0" marginheight="0">
<%
if request.cookies("Cnhww")("username")="" then
response.write "<script language=javascript>alert('对不起,您还没有登陆!');window.history.go(-1);;</script>"
response.End
end if
dim rs,bookname,id
id=request.QueryString("id")
if id="" then
response.write"<script>alert(""非法访问!"");location.href=""index.asp"";</script>"
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from products where bookid="&id,conn,1,1
if rs.bof and rs.eof then response.end
bookname=rs("bookname")
dhjf=rs("zhuanmaidian")
bianhao=rs("grade")
rs.close
set rs=nothing
%>
<form name="userform" method="post" action="duihuanadd.asp">
<table width="451" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="451" height="82" background="images/jifen04.jpg"> </td>
</tr>
<tr>
<td valign="top" background="images/jifen05.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="106" height="25" align="right">用户名:</td>
<td width="304" height="25"><input name="username" type="text" value="<%=request.cookies("Cnhww")("username")%>" size="40"></td>
</tr>
<tr>
<td height="25" align="right">商品ID:</td>
<td height="25"><input disabled="disabled" name="id" type="text" value="<%=id%>" size="40"></td>
</tr>
<tr>
<td height="25" align="right">商品编号:</td>
<td height="25"><input disabled="disabled" name="bianhao" type="text" value="<%=bianhao%>" size="40"></td>
</tr>
<tr>
<td height="25" align="right">商品名称:</td>
<td height="25"><input disabled="disabled" name="bookname" type="text" value="<%=bookname%>" size="40"></td>
</tr>
<tr>
<td height="25" align="right">所需积分:</td>
<td height="25"><input name="dhjf" type="text" value="<%=dhjf%>" size="40"></td>
</tr>
<tr>
<td height="25" align="right">您目前积分:</td>
<td height="25"><%=request.cookies("Cnhww")("jifen")%></td>
</tr>
<tr>
<td height="25" align="right">提交状态:</td>
<td height="25"><input name="zhuangtai" type="text" value="等待处理" size="40"></td>
</tr>
</table></td>
</tr>
<tr>
<td width="451" height="72" align="center" background="images/jifen06.jpg"><input type="image" src="images/anniuduihuan.jpg" name="Submit" value="提交"></td>
</tr>
</table></form>
</body>
</html>
提交确定页
<!--#include file="inc/Conn.asp"-->
<%
if request.cookies("Cnhww")("username")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆!');window.location.href='index.asp';</script>"
response.End
else
username=request.cookies("Cnhww")("username")
bookname=request("bookname")
bianhao=request("bianhao")
dhjf=request("zhuangmaidian")
id=request("id")
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "duihuan",conn,3,2
rs.addnew
rs("username")=username
rs("shopname")=bookname
rs("bianhao")=bianhao
rs("dhjf")=dhjf
rs("shopid")=id
rs("zhuangtai")=zhuangtai
rs("addtime")=now()
rs.update
rs.close
conn.close
set rs=nothing
set conn=nothing
response.Write "<script>alert('兑换申请成功,确定后自动跳转到兑换记录页!');location.href='userjifen.asp'</script>"
end if
%>
按你意思修改后 还是不能添加数据库里 郁闷呢 展开
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/config.asp"-->
<!--#include file="inc/Function.asp"-->
<html><head><title>积分兑换</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="images/css.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="5" marginwidth="0" marginheight="0">
<%
if request.cookies("Cnhww")("username")="" then
response.write "<script language=javascript>alert('对不起,您还没有登陆!');window.history.go(-1);;</script>"
response.End
end if
dim rs,bookname,id
id=request.QueryString("id")
if id="" then
response.write"<script>alert(""非法访问!"");location.href=""index.asp"";</script>"
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from products where bookid="&id,conn,1,1
if rs.bof and rs.eof then response.end
bookname=rs("bookname")
dhjf=rs("zhuanmaidian")
bianhao=rs("grade")
rs.close
set rs=nothing
%>
<form name="userform" method="post" action="duihuanadd.asp">
<table width="451" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="451" height="82" background="images/jifen04.jpg"> </td>
</tr>
<tr>
<td valign="top" background="images/jifen05.jpg"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="106" height="25" align="right">用户名:</td>
<td width="304" height="25"><input name="username" type="text" value="<%=request.cookies("Cnhww")("username")%>" size="40"></td>
</tr>
<tr>
<td height="25" align="right">商品ID:</td>
<td height="25"><input disabled="disabled" name="id" type="text" value="<%=id%>" size="40"></td>
</tr>
<tr>
<td height="25" align="right">商品编号:</td>
<td height="25"><input disabled="disabled" name="bianhao" type="text" value="<%=bianhao%>" size="40"></td>
</tr>
<tr>
<td height="25" align="right">商品名称:</td>
<td height="25"><input disabled="disabled" name="bookname" type="text" value="<%=bookname%>" size="40"></td>
</tr>
<tr>
<td height="25" align="right">所需积分:</td>
<td height="25"><input name="dhjf" type="text" value="<%=dhjf%>" size="40"></td>
</tr>
<tr>
<td height="25" align="right">您目前积分:</td>
<td height="25"><%=request.cookies("Cnhww")("jifen")%></td>
</tr>
<tr>
<td height="25" align="right">提交状态:</td>
<td height="25"><input name="zhuangtai" type="text" value="等待处理" size="40"></td>
</tr>
</table></td>
</tr>
<tr>
<td width="451" height="72" align="center" background="images/jifen06.jpg"><input type="image" src="images/anniuduihuan.jpg" name="Submit" value="提交"></td>
</tr>
</table></form>
</body>
</html>
提交确定页
<!--#include file="inc/Conn.asp"-->
<%
if request.cookies("Cnhww")("username")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆!');window.location.href='index.asp';</script>"
response.End
else
username=request.cookies("Cnhww")("username")
bookname=request("bookname")
bianhao=request("bianhao")
dhjf=request("zhuangmaidian")
id=request("id")
Set rs = Server.CreateObject("ADODB.Recordset")
rs.Open "duihuan",conn,3,2
rs.addnew
rs("username")=username
rs("shopname")=bookname
rs("bianhao")=bianhao
rs("dhjf")=dhjf
rs("shopid")=id
rs("zhuangtai")=zhuangtai
rs("addtime")=now()
rs.update
rs.close
conn.close
set rs=nothing
set conn=nothing
response.Write "<script>alert('兑换申请成功,确定后自动跳转到兑换记录页!');location.href='userjifen.asp'</script>"
end if
%>
按你意思修改后 还是不能添加数据库里 郁闷呢 展开
展开全部
这个要一步一步的来
首先看看duihuanadd.asp页面上
username=request.cookies("Cnhww")("username")
bookname=request("bookname")
bianhao=request("bianhao")
dhjf=request("zhuangmaidian")
id=request("id")
输出出来看看是否都有值存在
然后将
rs.Open "duihuan",conn,3,2 这句
改成
sql="select * from duihuan"
rs.open sql,conn,1,3
这样的duihuan 是要添加的表名
然后先添加
rs("username")=username
一条数据看看能不能成功
如果在不成功我也不知道了
首先看看duihuanadd.asp页面上
username=request.cookies("Cnhww")("username")
bookname=request("bookname")
bianhao=request("bianhao")
dhjf=request("zhuangmaidian")
id=request("id")
输出出来看看是否都有值存在
然后将
rs.Open "duihuan",conn,3,2 这句
改成
sql="select * from duihuan"
rs.open sql,conn,1,3
这样的duihuan 是要添加的表名
然后先添加
rs("username")=username
一条数据看看能不能成功
如果在不成功我也不知道了
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询