| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1405 人关注过本帖
标题:提交的数据,写不进数据库
只看楼主 加入收藏
gph
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-6-3
收藏
 问题点数:0 回复次数:12 
提交的数据,写不进数据库

提交的数据,写不进数据库,具体文件如下。

数据连接页面conn.asp代码如下:
<%
dim conn
dim connstr
on error resume next
connstr="DBQ="+server.mappath("database/database.asa")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>


数据提交页为:

<!--#include file="conn.asp"-->
<%
user=request("uname")
email=request("email")
pwd=request("pwd")


if InStr(ucase(user),"奸")>0 or InStr(ucase(user),"淫")>0 or InStr(ucase(user),"娼")>0 or InStr(ucase(user),"嫖")>0 or InStr(ucase(user),"性")>0 and InStr(ucase(user),"交")>0 or InStr(ucase(user),"妓")>0 or InStr(ucase(user),"色")>0 and InStr(ucase(user),"黄")>0 or InStr(ucase(user),"色")>0 and InStr(ucase(user),"情")>0 or InStr(ucase(user),"日")>0 and InStr(ucase(user),"妈")>0 or InStr(ucase(user),"日")>0 and InStr(ucase(user),"妹")>0 or InStr(ucase(user),"日")>0 and InStr(ucase(user),"姐")>0 or InStr(ucase(user),"日")>0 and InStr(ucase(user),"娘")>0 or InStr(ucase(user),"日")>0 and InStr(ucase(user),"奶")>0 or InStr(ucase(user),"乳")>0 or InStr(ucase(user),"阴")>0 or InStr(ucase(user),"操")>0 and InStr(ucase(user),"妈")>0 or InStr(ucase(user),"dia")>0 or InStr(ucase(user),"叼")>0 or InStr(ucase(user),"口刀")>0 or InStr(ucase(user),"色")>0 or InStr(ucase(user),"靠")>0 then
response.write "<script language=JavaScript>" & chr(13) & "alert('注册失败,姓名包含不雅字眼!');" & "history.back()" & "</script>"
response.end
end if

if InStr(ucase(user),"=")>0 or InStr(ucase(user),"`")>0 or InStr(ucase(user)," ")>0 or InStr(ucase(user)," ")>0 or InStr(ucase(user),"'")>0 or InStr(ucase(user),chr(34))>0 or InStr(ucase(user),"\")>0 or InStr(ucase(user),",")>0 or InStr(ucase(user),"<")>0 or InStr(ucase(user),">")>0 then
response.write "<script language=JavaScript>" & chr(13) & "alert('不能含有空格、<、>、=、引号、半角逗号、反斜杠等字符。');" & "history.back()" & "</script>"
response.end
end if

if InStr(ucase(user),"&")>0 or InStr(ucase(user),"=")>0 or InStr(ucase(user)," ")>0 then
response.write "<script language=JavaScript>" & chr(13) & "alert('帐号中包含非法字符!');" & "history.back()" & "</script>"
response.end
end if

user=replace(trim(request("uname")),"'","")
email= trim(request("email"))

Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from 公司资料 where 电子邮件='"&email&"' "
rs.open sql,conn,3,3
if not rs.eof then
response.write"<SCRIPT language=JavaScript>alert('电子邮件重复,请重新选择一个电子邮件!');"
response.write"javascript:history.go(-1)</SCRIPT>"
end if
rs.close
%>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>招聘网</title>
<link rel="stylesheet" type="text/css" href="../STYLE.CSS">
<link href="../sty.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
background-color: #0099FF;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
.style7 {color: #333333; font-weight: bold; }
.style8 {color: #FF0000}
-->
</style>
<link href="../windFx.css" rel="stylesheet" type="text/css">
</head>

<body>
<!--#include file="../inc/top2_zp.asp" -->
<table width="740" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td align="center">&nbsp;</td>
</tr>
<tr>
<td align="center"><table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../NewJOB2/lc_x0n.jpg" width="83" height="143"></td>
<td><img src="../NewJOB2/lc_x02.jpg" width="117" height="143"></td>
<td><img src="../NewJOB2/lc_x03_1.jpg" width="126" height="143"></td>
<td><img src="../NewJOB2/lc_xyx.jpg" width="127" height="143"></td>
<td><img src="../NewJOB2/lc_x06.jpg" width="84" height="143"></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<form action=creg2.asp method=post name=addnew3 onsubmit="return checkform()">
<tr valign="bottom">
<td colspan="3"> <div align="center"><img src="../images/2.gif" width="296" height="54" vspace="10"></div></td>
</tr>
<tr>
<td height="35" colspan="3"><div align="center" class="style8"><strong><br>
只需准确填写以下内容,即可免费成为招聘网企业会员,轻松实现网上招聘!</strong> <br>
<br>
----<br>
<span class="FB-12px-FF6600">正在进行大型优惠活动,2006年8月20日前成为正式会员,可享受超值优惠!<br>
详情请咨询:0551-5620131</span>
<hr width="600" size="1" noshade color="#dddddd">
</div></td>
</tr>
<tr>
<td width="25" rowspan="9" bgcolor="#37AFFF"><div align="center"><font color="#FFFFFF" class="fontbffffff"><img name="" src="" width="25" height="1" alt="">基<br>
本信<br>
息</font></div></td>
<td width="120" height="30" class="zi"><div align="center"><img src="" width="120" height="1" alt="">常用名称:
</div></td>
<td width="455" height="30" class="zi"><input name="name" type="text" size=38 maxlength=100>
<br>
*贵公司在本站的显示名称,您可以使用公司简称、公司品牌等公众知晓的名称</td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">公司全称: </div></td>
<td height="30" class="zi"><input name="name2" type="text" size=38 maxlength=100>
<br>
*公司全称在注册后不允许修改,请确定您填写的是贵公司营业执照上的全称</td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">公司性质:</div></td>
<td height="30" class="zi"><select name=properity size=1 tabindex=2>
<option selected>国有企业</option>
<option>外资企业</option>
<option>合资企业</option>
<option>私营企业</option>
<option>民营企业</option>
<option>股份制企业</option>
<option>集体企业</option>
<option>乡镇企业</option>
<option>行政机关</option>
<option>社会团体</option>
<option>事业单位</option>
<option>跨国公司(集团)</option>
<option>其他</option>
</select> </td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">属于行业:</div></td>
<td height="30" class="zi"><select name=hangyes size=1 tabindex=2>
<% set ptp = conn.execute("select * from pictype where shangjiid=134 order by id")
do while not ptp.eof%>
<option value="<%=ptp("types")%>"><%=ptp("typesid")%></option>
<% ptp.movenext
loop %>
</select> </td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">所在地区:</div></td>
<td height="30" class="zi"><select name=area style="width:100px">
<% set ptp = conn.execute("select * from pictype where shangjiid=165 order by id")
do while not ptp.eof%>
<option value="<%=ptp("typesid")%>"><%=ptp("types")%></option>
<% ptp.movenext
loop %>
</select></td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">成立日期:</div></td>
<td height="30" class="zi"><input maxlength=4 type="text" name=builtyear size=8>
年</td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">注册资金: </div></td>
<td height="30" class="zi"><input maxlength=10 name=fund type="text" size=12>
万元</td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">员工人数:</div></td>
<td height="30" class="zi"><select name=number>
<option selected>少于50人</option>
<option>50-200人</option>
<option>200-500人</option>
<option>500-1000人</option>
<option>1000人以上</option>
</select> </td>
</tr>
<tr>
<td height="100" class="zi"><div align="center">公司简介:</div></td>
<td class="zi"><textarea cols=60 name=intro rows=6></textarea></td>
</tr>
<tr>
<td height="25" colspan="3"><hr width="600" size="1" noshade color="#dddddd"></td>
</tr>
<tr>
<td rowspan="8" bgcolor="#37AFFF"><div align="center"><font color="#FFFFFF" class="fontbffffff">联<br>
系<br>
方<br>
式</font></div></td>
<td width="120" height="30" class="zi"><div align="center">联 系 人:
</div></td>
<td height="30" class="zi"><input type="text" maxlength=30 name=contact>
(多个联系人请用&quot;,&quot;隔开) </td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">联系电话: </div></td>
<td height="30" class="zi"><input name="citycode" type="text" size="6">
-
<input name=telephone size="10" type="text" maxlength=100>
(多个电话请用&quot;,&quot;隔开,请注意将区号写全) </td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">联系手机: </div></td>
<td height="30" class="zi"><input type="text" name=shouji maxlength=100>
(多个手机请用&quot;,&quot;隔开) </td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">传  真:</div></td>
<td height="30" class="zi"><input type="text" maxlength=100 name=fax >
(多个传真请用&quot;,&quot;隔开)</td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">电子邮箱: </div></td>
<td height="30" class="zi"><input maxlength=50 name=email> (请填写正确的电子邮箱,如果您以后忘记<br>
密码,我们将会把密码发送至该邮箱。)</td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">公司地址:</div></td>
<td height="30" class="zi"><input type="text" maxlength=200 name=address>
</td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">邮  编: </div></td>
<td height="30" class="zi"><input type="text" maxlength=6 name=postcode size=9>
</td>
</tr>
<tr>
<td height="30" class="zi"><div align="center">公司主页:</div></td>
<td height="30" class="zi"><span class=eng>http://</span> <input type="text" maxlength=50 name=web size=38>
<font color=#0000ff>(可不填)<br>
</font></td>
</tr>
<tr>
<td height="25" colspan="3"> <hr width="600" size="1" noshade color="#dddddd">
</td>
</tr>
<tr class="zi">
<td rowspan="4" bgcolor="#37AFFF"><div align="center"><font color="#FFFFFF" class="fontbffffff">会<br>
员<br>
信<br>
息</font></div></td>
<td height="30" colspan="2" class="zi"><div align="center">注意:用户名和密码只能为<strong class="style8">字母</strong>和<strong class="style8">数字</strong>(不能使用空格),<span class="style7">请您牢记用户名和密码</span>!</div></td>
</tr>
<tr class="zi">
<td height="30" class="zi"><div align="center">用 户 名:</div></td>
<td height="30" class="zi"><input maxlength=20 name=user size=30>
(3~10个字符)</td>
</tr>
<tr class="zi">
<td height="30" class="zi"><div align="center">密  码:</div></td>
<td height="30" class="zi"><input maxlength=14 name=pwd size=30 type=password>
(6~15个字符)</td>
</tr>
<tr class="zi">
<td height="30" class="zi"><div align="center">重复密码:</div></td>
<td height="30" class="zi"><input maxlength=14 name=password size=30 type=password>
(请再输入一遍密码) </td>
</tr>
<tr>
<td height="25" colspan="3">&nbsp; </td>
</tr>
<tr>
<td height="45" colspan="3"><div align="center">
<input type="submit" name="Submit" value="好了,我要提交注册" >
</div></td>
</tr>
</form>
</table>
<!--#include file="../copyright.asp"--></td>
</tr>
</table>
</body>
</html>

保存页面如下:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--#include file="conn.asp"-->

<%
'控制从外部提交的信息
if not instr(1,Request.ServerVariables("http_Referer"),Request.ServerVariables ("SERVER_NAME"),1)=8 then
response.write "<b>请从本站点提交信息</b>"
response.end
end if
user=request.form("user")

if user = "管理员" then
response.write "<b>请不要提交保留字!</b>"
response.end
end if

pwd=request.form("pwd")
name=request.form("name")
name2=request.form("name2")
properity=request.form("properity")
hangyes=request.form("hangyes")
builtyear=request.form("builtyear")
fund=request.form("fund")
number=request.form("number")
web=request.form("web")
intro=request("intro")
contact=request.form("contact")
telephone=request.form("telephone")
fax=request.form("fax")
email=request.form("email")
address=request.form("address")
postcode=request.form("postcode")
shouji=request.form("shouji")
area=request.form("area")
citycode=request.form("citycode")


if web="" then web="无"
if fax="" then fax="无"

'控制公司简介

'验证用户名是否为空
set rs=server.createobject("ADODB.Recordset")
sql="select * from 公司资料 where 帐号='"&user&"'"
rs.open sql,conn,3,3
if not rs.eof then
response.write"<SCRIPT language=JavaScript>alert('该用户名已经被注册!返回');"
response.write"javascript:history.go(-1)</SCRIPT>"
response.end
end if


conn.execute "insert into 公司资料 (帐号,密码,公司名称,公司全称,公司性质,行业,成立日期,注册资金,员工,站点,简介,联系人,电话,传真,电子邮件,地址,邮编,会员注册时间,手机,地区,区号) values ('"&user&"','"&pwd&"','"&name&"','"&name2&"','"&properity&"','"&hangyes&"',"&builtyear&"','"&fund&"','"&number&"','"&web&"','"&intro&"','"&contact&"','"&telephone&"','"&fax&"','"&email&"','"&address&"','"&postcode&"','"&date()&"','"&shouji&"','"&area&"','"&citycode&"')"

conn.close
set conn = nothing

session("y_ren_user")=user
Response.Write("<script language=""JavaScript"">alert(""尊敬的用户,您已注册成功!请进入用户管理中心!"");location.href='default.asp';</script>")
'response.endresponse.redirect "default_test.asp"
%>

页面显示数据提交成功,可数据库里没有,请名家指点一二,谢谢了

[此贴子已经被作者于2006-7-18 15:54:03编辑过]

搜索更多相关主题的帖子: 数据库 
2006-07-10 14:16
hangxj
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2045
专家分:0
注 册:2006-4-10
收藏
得分:0 
没有搜索就来发问!

老问题,数据库的读写权限问题

属性-->安全--> 设置Everyone的权限为完全控制

http://www./
2006-07-11 09:02
gph
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-6-3
收藏
得分:0 

老大,我这个数据库的别的表,都能写入,只有向这个表提交数据,数据为空

2006-07-11 09:54
gph
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-6-3
收藏
得分:0 

没有人帮忙吗

2006-07-11 15:05
gph
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-6-3
收藏
得分:0 

up

2006-07-18 15:54
gph
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-6-3
收藏
得分:0 

再次up

2006-07-19 13:50
islet
Rank: 12Rank: 12Rank: 12
等 级:贵宾
威 望:89
帖 子:6548
专家分:0
注 册:2005-1-28
收藏
得分:0 
1、看看conn文件里面有 on error resume next 注释掉再调适
2、没有给足条件执行数据添加
2006-07-19 14:08
gph
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-6-3
收藏
得分:0 

谢谢,我试一下

2006-07-20 09:49
gph
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-6-3
收藏
得分:0 
以下是引用islet在2006-7-19 14:08:21的发言:
1、看看conn文件里面有 on error resume next 注释掉再调适
2、没有给足条件执行数据添加

不是1、的问题,

2、没有给足条件执行数据添加是什么意思


错误提示为:
Microsoft VBScript 编译器错误 错误 '800a0401'

语句未结束

creg2.asp,行 52

conn.execute "insert into 公司资料 (帐号,密码,公司名称,公司性质,成立日期,注册资金,员工,站点,简介,联系人,电话,传真,电子邮件,地址,邮编,公司全称,行业,地区,zhaopinhui,会员,会员到期时间,审核,手机,区号) values ('"&user&"','"&pwd&"','"&name&"','"&properity&"','"&builtyear&"','"&fund&"','"&number&"','"&web&"','"&intro&"','"&contact&"','"&telephone&"','"&fax&"','"&email&"','"&address&"','"&postcode&"','"&name2&"','"&hangyes&"','"&area&"','"&zhaopinhui&"','免费会员','',0,'"&shouji&"','"&citycode&"')"
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------^

[此贴子已经被作者于2006-7-20 11:00:03编辑过]

2006-07-20 10:47
gph
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-6-3
收藏
得分:0 
up

hangxj:

自己不先根据错误提示就来UP?
可以说是属于灌水哦!
下次注意
2006-07-20 14:32
快速回复:提交的数据,写不进数据库
数据加载中...
 
   



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

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