| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1317 人关注过本帖
标题:[求助]提交表单后,报错,没插入数据库
只看楼主 加入收藏
mlly1983
Rank: 1
等 级:新手上路
帖 子:46
专家分:0
注 册:2007-7-21
收藏
 问题点数:0 回复次数:19 
[求助]提交表单后,报错,没插入数据库

--------a.asp
<body>
<%SMT_TOP%>
<table>
<tr>
<td>
<table>
<tr>
<td>
<table>
<form name="form2" method="post" action="b.asp" onSubmit="return checkdata();">
<tr>
<td>求购信息</td>
</tr>
<tr>
<td>求购类别:
<select name="ypxxone_id">
<option value="" selected>请选择类别</option>
<%
sql11="select * from SMT_ypxxone order by SMT_date desc"
set rs11=server.createobject("ADODB.Recordset")
rs11.open sql11,conn,1,1
while not rs11.eof
%>
<option value="<%=rs11("SMT_ypxxone_id")%>"><%=rs11("SMT_ypxxone")%></option>
<%rs11.movenext
wend
rs11.Close()
%>
</select>
</font></td>
</tr>
<tr>
<td>
<div id="all" style="position:relative;>
<div id="50" style="position:absolute;visibility: hidden;">
<table>

<tr>
<%sql12="select * from SMT_ypxxtwo where SMT_ypxxone_id=50 order by SMT_date desc"
set rs12=Server.CreateObject("ADODB.Recordset")
rs12.open sql12,conn,1,1
if (rs12.eof and rs12.bof) then
response.write "<tr><td>暂无内容</td></tr>"
else
n=0 do while not rs12.eof
n=n+1
%>
<td><input name="checkbox_x" type="checkbox"value="<%=rs12("SMT_ypxxtwo_id")%>"><%=rs12("SMT_ypxxtwo")%></td>
<%if n mod 4=0 then response.write"</tr><tr align=center>"
rs12.movenext
loop
end if
rs12.close
set rs12=nothing
%>
</tr>
</table>
</div>
<div id="49" style="position:absolute; visibility: hidden">
<table>
<tr>
<%sql13="select * from SMT_ypxxtwo where SMT_ypxxone_id=49 order by SMT_date desc"
set rs13=Server.CreateObject("ADODB.Recordset")
rs13.open sql13,conn,1,1
if (rs13.eof and rs13.bof) then
response.write "<tr><td height=20 colspan=3>暂无内容</td></tr>"
else
n=0
do while not rs13.eof
n=n+1
%>
<td><input name="checkbox_x" type="checkbox" value="<%=rs13("SMT_ypxxtwo_id")%>"><%=rs13("SMT_ypxxtwo")%></td>
<%if n mod 4=0 then response.write"</tr><tr align=center>"
rs13.movenext
loop
end if
rs13.close
set rs13=nothing
%>
</tr>
</table>
</div>
</div>
</td>
</tr>
<tr>
<td>求购名称</td>
<td><input id="text" name="stitle" type="text" size="50" maxlength="48"></td>
</tr>
<tr>
<td>代理产品</td>
<td><input id="text" name="shistory" type="text" size="50" maxlength="48"></td>
</tr>
<tr>
<td>区域</td>
<td>
<div align="left">
<p>
<input name="shopesheng" class=t11 type="checkbox" id="hopesheng" value="全国" />
<label for="01">全?国</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="北京" />
<label for="02">北京</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="上海" />
<label for="03">上海</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="天津" />
<label for="04">天津</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="重庆" />
<label for="05">重庆</label>

<br />
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="广东" />
<label for="06">广东</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="福建" />
<label for="34">福建</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="浙江" />
<label for="07">浙江</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="江苏" />
<label for="08">江苏</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="山东" />
<label for="09">山东</label>

<br />
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="辽宁" />
<label for="10">辽宁</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="江西" />
<label for="11">江西</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="四川" />
<label for="12">四川</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="湖北" />
<label for="13">湖北</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="河北" />
<label for="14">河北</label>

<br />
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="陕西" />
<label for="15">陕西</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="河南" />
<label for="16">河南</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="吉林" />
<label for="17">吉林</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="黑龙江" />
<label for="18">黑龙江</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="山西" />
<label for="19">山西</label>

<br />
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="内蒙" />
<label for="20">内蒙</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="湖南" />
<label for="21">湖南</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="安徽" />
<label for="22">安徽</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="广西" />
<label for="35">广西</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="海南" />
<label for="23">海南</label>

<br/>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="云南" />
<label for="24">云南</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="西藏" />
<label for="25">西藏</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="贵州" />
<label for="26">贵州</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="甘肃" />
<label for="27">甘肃</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="宁夏" />
<label for="28">宁夏</label>

<br/>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="青海" />
<label for="29">青海</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="新疆" />
<label for="30">新疆</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="香港" />
<label for="31">香港</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="澳门" />
<label for="32">澳门</label>
<input class=t11 type="checkbox" name="shopesheng" id="hopesheng" value="台湾" />
<label for="33">台湾</label>
</p>
</div>
</td>
</tr>
<tr>
<td>求购述说</td>
<td>
<textarea name="stext" cols="50" rows="5" id="text3"></textarea>
</td>
<td>*</td>
</tr>
<tr>
<td>现有销售渠道</td>
<td><input id="text" name="schannels" type="text" size="50" maxlength="48"></td>
</tr>
<tr>
<td>联系方式</td>
</tr>
<tr>
<td>公司名称<input id="text1" name="name1" type="text" size="50" maxlength="48">
<input name="sshengfen" type="radio" value="公司" checked>公司
<input type="radio" name="sshengfen" value="个人" >个人</td>
</tr>
<tr>
<td>联系人<input id="text1" name="scontacts" type="text" size="50" maxlength="48"></td>
</tr>
<tr>
<td>电话<input id="text1" name="stelephone" type="text" size="50" maxlength="48">*</td>
</tr>
<tr>
<td>手机<input id="text1" name="stel" type="text" size="50" maxlength="48"></td>
</tr>
<tr>
<td>传真<input id="text1" name="sfax" type="text" size="50" maxlength="48"></td>
</tr>
<tr>
<td>联系地址<input id="text1" name="saddress" type="text" size="50" maxlength="48"></td>
</tr>
<tr>
<td>邮编<input id="text1" name="szip" type="text" size="50" maxlength="48"></td>
</tr>
<tr>
<td>网址<input id="text2" name="swebsite" type="text" size="50" maxlength="48">在线QQ:<input id="text2" name="sqq" type="text" size="50" maxlength="48"></td>
</tr>
<tr>
<td>电子邮箱<input id="text1" name="smail" type="text" size="50" maxlength="48"></td>
</tr>
<tr>
<td><input type="image" name="tijiao" value="提交" src="img/tijiao.jpg" style="border:0; "><img src="img/quxiao.jpg" onclick="document.all.form2.reset();" style="cursor:hand "/></td>
</tr>
</form>
</table>

-------------------b.asp

<%
strcheckbox=Request("checkbox_x")
if strcheckbox="" then
errstyle="·选择产品大类后请选择相应小类!"
scripterr
else
strcheckbox=strcheckbox
end if

ypxxone_id=Request("ypxxone_id")
if ypxxone_id="" then
errstyle="·选择产品大类后请选择相应小类!"
scripterr
else
ypxxone_id=ypxxone_id
end if

stitle = Request("stitle")
if stitle = "" then stitle = null

shistory = Request("shistory")
if shistory = "" then shistory = null

shopesheng = Request("shopesheng")
if shopesheng = "" then shopesheng = null

stext = Request("stext")
if stext=""or len(stext)<300 then
errstyle="·请输入小于300字的求购述说。"
scripterr --------------------------------------------第31行
end if

schannels = Request("schannels")
if schannels = "" then schannels = null

sname1 = Request("sname1")
if sname1 = "" then sname1 = null

sshengfen = Request("sshengfen")
if sshengfen="" then
errstyle="·请选择公司名称!"
scripterr
end if

scontacts = Request("scontacts")
if scontacts="" then
errstyle="·请输入联系人!"
scripterr
end if

stelephone = Request("stelephone")
if stelephone="" then
stelephone="·请输入电话!"
scripterr
end if

stel = Request("stel")
if stel = "" then stel = null

sfax = Request("sfax")
if sfax = "" then sfax = null

saddress = Request("saddress")
if saddress = "" then saddress = null

szip = Request("szip")
if szip = "" then szip = null

swebsite = Request("swebsite")
if swebsite = "" then swebsite = null

sqq = Request("sqq")
if sqq = "" then sqq = null

smail = Request("smail")
if smail = "" then smail = null



set rs=Server.CreateObject("Adodb.Recordset")
sql="select * from zzwork3 "
rs.open sql,conn,1,3
rs.addnew()
rs("SMT_ypxxone_id") = ypxxone_id
rs("SMT_ypxxtwo_id") = strcheckbox
rs("title") = stitle
rs("history") = shistory
rs("hopesheng") = shopesheng
rs("text") = stext
rs("channels") = schannels
rs("name1") = sname1
rs("contacts") = scontacts
rs("shengfen") = sshengfen
rs("telephone") = stelephone
rs("tel") = stel
rs("fax") = sfax
rs("address") = saddress
rs("zip") = szip
rs("website") = swebsite
rs("qq") = sqq
rs("mail") = smail
rs("smt_ypaddone_id") = null
rs("smt_ypaddtwo_id") = null

rs.update
rs.close
set rs=nothing
conn.close
set conn = nothing

response.redirect("a.asp")
%>


数据库:
图片附件: 游客没有浏览图片的权限,请 登录注册


提交表单后,报错,没插入数据库,还望各位大侠指点,谢谢.

[此贴子已经被作者于2007-8-7 9:56:32编辑过]

搜索更多相关主题的帖子: 数据库 表单 
2007-08-03 10:50
阳光白雪
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:39
帖 子:2220
专家分:0
注 册:2005-11-18
收藏
得分:0 
if stext=""or len(stext)<300 then
errstyle="·请输入小于300字的求购述说。"
scripterr
end if

还有后面的几处,注意语法规则

专注于WEB前端交互平台开发:[url=http://blog./]blog.[/url](富客户端技术(RIA)交流平台)
2007-08-03 10:54
mlly1983
Rank: 1
等 级:新手上路
帖 子:46
专家分:0
注 册:2007-7-21
收藏
得分:0 
什么问题啊?为什么提交不了~~
2007-08-04 08:29
ayue222
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:341
专家分:0
注 册:2007-7-25
收藏
得分:0 
数据库中 id 类型添加自动增长
2007-08-04 10:17
mlly1983
Rank: 1
等 级:新手上路
帖 子:46
专家分:0
注 册:2007-7-21
收藏
得分:0 
图片附件: 游客没有浏览图片的权限,请 登录注册

是identity呀
2007-08-04 10:47
ayue222
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:341
专家分:0
注 册:2007-7-25
收藏
得分:0 
报错信息是啥?
这里注意写入的int数据类型
2007-08-04 10:53
mlly1983
Rank: 1
等 级:新手上路
帖 子:46
专家分:0
注 册:2007-7-21
收藏
得分:0 

500错误

2007-08-04 10:58
madpbpl
Rank: 4
等 级:贵宾
威 望:11
帖 子:2876
专家分:244
注 册:2007-4-5
收藏
得分:0 
选择ie--》工具--》internet选项--》高级---》显示友好http错误信息
前面的勾去掉,再运行一下程序,把错误发上来
2007-08-04 13:14
mlly1983
Rank: 1
等 级:新手上路
帖 子:46
专家分:0
注 册:2007-7-21
收藏
得分:0 

错误为:
Microsoft VBScript 运行时错误 错误 '800a000d'

类型不匹配: 'scripterr'

/xyao/b.asp,行 31

[此贴子已经被作者于2007-8-7 10:04:43编辑过]

2007-08-07 09:48
mlly1983
Rank: 1
等 级:新手上路
帖 子:46
专家分:0
注 册:2007-7-21
收藏
得分:0 
9命啊
2007-08-07 10:18
快速回复:[求助]提交表单后,报错,没插入数据库
数据加载中...
 
   



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

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