| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 674 人关注过本帖
标题:输入的表单为什么不安能写入数据库(环境没有问题,数据也是正常的,程序可能有 ...
只看楼主 加入收藏
yingying2008
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-1-1
收藏
 问题点数:0 回复次数:5 
输入的表单为什么不安能写入数据库(环境没有问题,数据也是正常的,程序可能有问题)

请高手看看,这段代码输入的表单为什么不安能写入数据库(环境没有问题,数据也是正常的,程序可能有问题)

<!--#include file="sys/conn.asp"-->
<%
if request("action")="update" then
id=request("id")
set rs=server.createobject("adodb.recordset")
sqltext="select * from fangwu where id="&id
rs.open sqltext,conn,3,3
fwdz=request.form("fwdz")
jfjc=request.form("jfjc")
jhcz=request.form("jhcz")
jctcz=request.form("jctcz")
jgkmt=request.form("jgkmt")
jsyzx=request.form("jsyzx")
jhxjq=request.form("jhxjq")
if fwdz = "" then fwdz = "未知" end if
rs("fwdz") = fwdz
if jfjc = "" then jfjc = "未知" end if
rs("jfjc") = jfjc
if jhcz = "" then jhcz = "未知" end if
rs("jhcz") = jhcz
if jctcz = "" then jctcz = "未知" end if
rs("jctcz") = jctcz
if jgkmt = "" then jgkmt = "未知" end if
rs("jgkmt") = jgkmt
if jsyzx = "" then jsyzx = "未知" end if
rs("jsyzx") = jsyzx
if jhxjq = "" then jhxjq = "未知" end if
rs("jhxjq") = jhxjq
rs("c_name")=request.form("hotelname")
rs("level")=request.form("hotellevel")
rs("province")=request.form("szSheng")
rs("city")=request.form("szShi")
rs("info")=request.form("hotelinfo")
rs("logurl")=request.form("hotellogurl")
rs("logurl2")=request.form("hotellogurl2")
rs("logurl3")=request.form("hotellogurl3")
rs("logurl4")=request.form("hotellogurl4")
rs("logurl5")=request.form("hotellogurl5")
rs("logurl6")=request.form("hotellogurl6")
rs("logurl7")=request.form("hotellogurl7")
rs("logurl8")=request.form("hotellogurl8")
rs("logurl9")=request.form("hotellogurl9")
rs("logurl10")=request.form("hotellogurl10")
rs("tuijian_id")=request.form("tuijian1")
rs.update
rs.close
conn.close
response.redirect "fwinfo.asp"

else
id=request("id")
set rs=server.createobject("adodb.recordset")
sqltext="select * from fangwu where id="&id
rs.open sqltext,conn,1,1
%>
<html>
<head>
<title>出租房信息编辑</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="system/style.css" type="text/css">
</head>
<body>
<FORM ACTION="editfw.asp" METHOD="POST" NAME="FORM1" onsubmit="return form1_onsubmit()">
<input type=hidden name=action value="update">
<input type=hidden name=id value=<%=request("id")%>>
<div align="center"><br><br><br>
<table width="65%" border=1 align="center" cellPadding=0 cellSpacing=0 bordercolor="#999999" borderColorDark=#ffffff bgcolor="#F9F9F9">
<tbody>
<tr background="Images/topBar_bg.gif">
<td height="30" colspan=2 background="Images/topBar_bg.gif" align="center"><font color="red">出租房信息编辑</font></td>
</tr>
<tr>
<td width=112 height=25 align="right" bgcolor=#EBEBEB >出租房名称:</td>
<td width=396 height=25><input name="hotelname" value="<%=rs("c_name")%>" size="20" maxlength="20">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td width=112 height=25 align="right" bgcolor=#EBEBEB >出租房地址:</td>
<td width=396 height=25><input name="fwdz" id="fwdz" value="<%=rs("fwdz")%>" size="20" maxlength="20">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td width=112 height=25 align="right" bgcolor=#EBEBEB >距飞机场:</td>
<td width=396 height=25><input name="jfjc" id="jfjc" value="<%=rs("jfjc")%>" size="20" maxlength="20">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td width=112 height=25 align="right" bgcolor=#EBEBEB >距火车站:</td>
<td width=396 height=25><input name="jhcz" id="jhcz" value="<%=rs("jhcz")%>" size="20" maxlength="20">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td width=112 height=25 align="right" bgcolor=#EBEBEB >距长途车站:</td>
<td width=396 height=25><input name="jctcz" id="jctcz" value="<%=rs("jctcz")%>" size="20" maxlength="20">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td width=112 height=25 align="right" bgcolor=#EBEBEB >距港口码头:</td>
<td width=396 height=25><input name="jgkmt" id="jgkmt" value="<%=rs("jgkmt")%>" size="20" maxlength="20">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td width=112 height=25 align="right" bgcolor=#EBEBEB >距商业中心:</td>
<td width=396 height=25><input name="jsyzx" id="jsyzx" value="<%=rs("jsyzx")%>" size="20" maxlength="20">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td width=112 height=25 align="right" bgcolor=#EBEBEB >距核心景区:</td>
<td width=396 height=25><input name="jhxjq" id="jhxjq" value="<%=rs("jhxjq")%>" size="20" maxlength="20">
<font color="#FF0000">*</font></td>
</tr>
<tr>
<td height="35" colspan=2 background="Images/topBar_bg.gif">
<p align="center">
<input type=SUBMIT value=" 修 改 " class="medium" onClick="javascript:return checksignup()" name="signup_submit">
<input type=RESET value="重 填" class="medium" name="signup_reset">
<input name="button" type="button" class="main" onClick="javascript:window.history.go(-1)" value="返回" size="3">
</td>
</tr>
</table>
</div>
<p align="center">
</form>

</body>
</html>
<%
rs.close
conn.close
end if
%>

搜索更多相关主题的帖子: 数据库 表单 request form 
2007-01-09 10:59
yingying2008
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-1-1
收藏
得分:0 
程序确实是有问题,我也不知道错在哪儿,为什么不能写入数据库.

2007-01-09 10:59
lq7350684
Rank: 6Rank: 6
等 级:贵宾
威 望:20
帖 子:5089
专家分:98
注 册:2006-11-6
收藏
得分:0 
rs("c_name")=request.form("hotelname")
rs("level")=request.form("hotellevel")
rs("province")=request.form("szSheng")
rs("city")=request.form("szShi")
rs("info")=request.form("hotelinfo")
rs("logurl")=request.form("hotellogurl")
rs("logurl2")=request.form("hotellogurl2")
rs("logurl3")=request.form("hotellogurl3")
rs("logurl4")=request.form("hotellogurl4")
rs("logurl5")=request.form("hotellogurl5")
rs("logurl6")=request.form("hotellogurl6")
rs("logurl7")=request.form("hotellogurl7")
rs("logurl8")=request.form("hotellogurl8")
rs("logurl9")=request.form("hotellogurl9")
rs("logurl10")=request.form("hotellogurl10")
rs("tuijian_id")=request.form("tuijian1")


这些是哪来的,根本表单里就没有这些嘛.
修改也不是你这样修改的.
2007-01-09 11:57
yingying2008
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-1-1
收藏
得分:0 
为什么不能写入数据库呢,请高手解答啊

2007-01-09 12:08
yingying2008
Rank: 1
等 级:新手上路
帖 子:33
专家分:0
注 册:2007-1-1
收藏
得分:0 
这几个参数不能写入!

fwdz=request.form("fwdz")
jfjc=request.form("jfjc")
jhcz=request.form("jhcz")
jctcz=request.form("jctcz")
jgkmt=request.form("jgkmt")
jsyzx=request.form("jsyzx")
jhxjq=request.form("jhxjq")

2007-01-09 12:10
雨蒙珍珍
Rank: 1
等 级:新手上路
威 望:1
帖 子:169
专家分:0
注 册:2006-4-10
收藏
得分:0 
自己锻炼一下你调试程序的能力吧。
给你说个思路。
1检查你的变量名是否写对了。
2检查变量的状态。最好把他们输出来。看看有没有值,值的类型对不对。
3把你的字段减几个 试试行不行。



2007-01-09 13:05
快速回复:输入的表单为什么不安能写入数据库(环境没有问题,数据也是正常的,程序 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013032 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved