注册 登录
编程论坛 ASP技术论坛

为什么我用如下代码实现数据插入数据库确提示网页无法实现?

xwhaohuai 发布于 2007-10-09 11:41, 806 次点击

<!--#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上就可以运行,放到服务器就不可以了,说网页无法显示?求救!!!

5 回复
#2
xwhaohuai2007-10-09 14:45
添加数据后说是内部服务器出错,版主,请帮帮忙!!!
#3
yms1232007-10-09 16:00
把报错信息的详细内容贴出来。
#4
favoriteran2007-10-09 16:01

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

#5
xwhaohuai2007-10-09 16:14
无法显示网页
您要访问的网页有问题,无法显示。
HTTP 500 - 内部服务器错误
Internet Explorer

这个就是错误的信息
#6
xwhaohuai2007-10-09 17:13
问题已解决,服务器数据库发生错误.
1