标题:为什么我用如下代码实现数据插入数据库确提示网页无法实现?
只看楼主
xwhaohuai
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2007-9-29
 问题点数:0 回复次数:5 
为什么我用如下代码实现数据插入数据库确提示网页无法实现?

<!--#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:41
xwhaohuai
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2007-9-29
得分:0 
添加数据后说是内部服务器出错,版主,请帮帮忙!!!
2007-10-09 14:45
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
得分:0 
把报错信息的详细内容贴出来。
2007-10-09 16:00
favoriteran
Rank: 1
等 级:新手上路
帖 子:142
专家分:0
注 册:2006-3-10
得分:0 

有没有对数据库修改的权限?


海納百川,一切從源開始........
2007-10-09 16:01
xwhaohuai
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2007-9-29
得分:0 
无法显示网页
您要访问的网页有问题,无法显示。
HTTP 500 - 内部服务器错误
Internet Explorer

这个就是错误的信息
2007-10-09 16:14
xwhaohuai
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2007-9-29
得分:0 
问题已解决,服务器数据库发生错误.
2007-10-09 17:13



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-176063-1-1.html




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

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