| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 594 人关注过本帖
标题:为什么我用如下代码实现数据插入数据库确提示网页无法实现?
只看楼主 加入收藏
xwhaohuai
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2007-9-29
收藏
 问题点数:0 回复次数:4 
为什么我用如下代码实现数据插入数据库确提示网页无法实现?

<!--#include file="inc/conn.asp"-->
<%
name=replace(trim(request.form("name")),"'","")
sex=replace(trim(request.form("sex")),"'","")
years=replace(trim(request.form("year")),"'","")
months=replace(trim(request.form("month")),"'","")
mobile=replace(trim(request.form("mobile")),"'","")
where=replace(trim(request.form("zhuanye")),"'","")
glass=replace(trim(request.form("glass")),"'","")
zhuanye=replace(trim(request.form("zhuanye")),"'","")
number=replace(trim(request.form("number")),"'","")
phone=replace(trim(request.form("phone")),"'","")

type1=replace(trim(request.form("type1")),"'","")
type2=replace(trim(request.form("type2")),"'","")
type3=replace(trim(request.form("type3")),"'","")
type4=replace(trim(request.form("type4")),"'","")
type5=replace(trim(request.form("type5")),"'","")
type6=replace(trim(request.form("type6")),"'","")
trun=replace(trim(request.form("trun")),"'","")


if name="" then
response.write "<SCRIPT language=JavaScript>alert('姓名不能为空 或 输入字符非法!');"
response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
end if
if number="" then
response.write "<SCRIPT language=JavaScript>alert('学号不能为空 或 输入字符非法!');"
response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
end if
if glass="" then
response.write "<SCRIPT language=JavaScript>alert('年级不能为空 或 输入字符非法!');"
response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
end if
if zhuanye="" then
response.write "<SCRIPT language=JavaScript>alert('专业不能为空 或 输入字符非法!');"
response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
end if
if mobile="" then
response.write "<SCRIPT language=JavaScript>alert('身份证号不能为空 或 输入字符非法!');"
response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
end if

if type1="" and type2="" and type3="" and type4="" and type5="" and type6=""then
response.write "<SCRIPT language=JavaScript>alert('必须选择一门课程!');"
response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
end if
if trun=""then
response.write "<SCRIPT language=JavaScript>alert('必须选择轮数!');"
response.write "this.location.href='vbscript:history.back()';</SCRIPT>"
response.end
end if
%>
<%


set rs=server.createobject("adodb.recordset")
sqltext="select * from orderlist"
rs.open sqltext,cn,3,3

rs.addnew
rs("name")=request.form("name")
rs("number")=request.form("number")
rs("zhuanye")=request.form("zhuanye")
rs("glass")=request.form("glass")
rs("mobile")=request.form("mobile")
rs("phone")=request.form("phone")
rs("where")=request.form("where")
rs("year")=request.form("year")
rs("month")=request.form("month")
rs("sex")=request.form("sex")

rs("type1")=request.form("type1")
rs("type2")=request.form("type2")
rs("type3")=request.form("type3")
rs("type4")=request.form("type4")
rs("type5")=request.form("type5")
rs("type6")=request.form("type6")
rs("trun")=request.form("trun")

rs.update
session("name") = request.form("name")
session("number") = request.form("number")
session("glass") = request.form("glass")
session("mobile") = request.form("mobile")
session("zhuanye") = request.form("zhuanye")
session("year") = request.form("year")
session("month") = request.form("month")
session("sex") = request.form("sex")
session("phone") = request.form("phone")
session("where") = request.form("where")

response.write "<SCRIPT language=JavaScript>alert('报名成功!');"
response.write "this.location.href='application2.asp';</SCRIPT>"
%>
在自己电脑的IIS上就可以运行但放到网上就无法运行了,求救!!!!

搜索更多相关主题的帖子: form trim replace 数据库 
2007-10-09 11:16
xwhaohuai
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2007-9-29
收藏
得分:0 
怎么没人说话啊
2007-10-09 11:35
xwhaohuai
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2007-9-29
收藏
得分:0 
哪位大虾可以帮下我吗?谢谢
2007-10-09 11:36
xwhaohuai
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2007-9-29
收藏
得分:0 
2007-10-09 11:39
xiaoyutou
Rank: 1
等 级:新手上路
帖 子:29
专家分:0
注 册:2007-3-29
收藏
得分:0 
你查看一下你的conn.asp文件,是不是连接数据库的代码有问题,例如"连接的服务器"是不是正确.

凡事由其自然,遇了处之泰然,得意之时淡然,失意之时坦然,艰辛曲折必然,历尽沧桑悟然。
2007-10-09 17:28
快速回复:为什么我用如下代码实现数据插入数据库确提示网页无法实现?
数据加载中...
 
   



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

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