为什么会有错误?

coolXbai 2003-09-02 06:37:14
这是我写的一个ASP的程序,但是执行就有错误,说是500内部服务器错误,
为什么啊?
有人能帮帮我吗?

<!--#include file=conn.asp-->
<%
dim rs
dim sql
dim sername
dim sernum 
dim serplaynum 
dim youname 
dim youqq 
dim youemail
dim youtel
dim youidea
dim founderr
founderr=false
dim errmsg
if trim(Request("txtsername"))="" then
founderr=true
errmsg="服务器名字不能为空"
end if
if trim(Request("txtsernum"))="" then
founderr=true
errmsg="服务器支持人数不能为空"
end if
if trim(Request("txtserplaynum"))="" then
founderr=true
errmsg="服务器玩家数量不能为空"
end if
if trim(Request("txtyouname"))="" then
founderr=true
errmsg="您的名字不能为空"
end if
if trim(Request("txtyoutel"))="" then
founderr=true
errmsg="您的电话不能为空"
end if
set rs=server.createobject("adodb.recordset")
if founder=false then
sername=Request.form("txtsername")
sernum=Request.form("txtsernum")
serplaynum=Request.form("txtserplaynum")
youname=Request.form("txtyouname")
youtel=Request.form("txtyoutel")
if Request.form("txtyouqq")="" then
youqq="0"
else
youqq=Request.form("txtyouqq")
end if
if Request.form("txtyouemail")="" then
youemail="无"
youemail=Request.form("txtyouemail")
end if
if Request.form("txtcontent")="" then
youidea="无"
youidea=Request.form("txtyoucontent")
end if
sql="select * from data where (ID is null)"
rs.open sql,conn,1,1
rs.addnew
rs("sername")=sername
rs("sernum")=sernum
rs("serplaynum")=serplaynum
rs("youname")=youname
rs("youtel")=youtel
rs("youqq")=youqq
rs("youemail")=youemaill
rs("youidea")=youidea
rs.update
rs.close
conn.close
set rs=nothing
set conn=nothing

%>

<html>

<head>
<title>成功</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<body>
<div align="center"><center>
<br><br>
<table width="50%" border="1" cellpadding="0" cellspacing="0" bordercolor="#999999">
<tr>
<td width="100%" bgcolor="#999999" height="20"><p align="center"><font color="#FFFFFF"><b>
数据添加成功!!!</b></font></td>
</tr>
<tr>
<td width="100%"><p align="left"><br>恭喜你!</p>
您可以进行其他操作
</td>
</tr>
</table>
</center></div>
<%
else
response.write "由于以下的原因不能保存数据:"
response.write errmsg
end if
%>

</body>
</html>
...全文
16 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
coolXbai 2003-09-03
  • 打赏
  • 举报
回复
问题在这几个变量上
dim sername
dim sernum 
dim serplaynum 
dim youname 
dim youqq 
dim youemail
注意一下就会发现,这几个变量后有空格
我把这几个空格删除就好的

晕不晕啊,真想不到

PS:还是要再谢谢johnnywang1980(地鬼) ,我是菜鸟,第一次做ASP的程序,连这种很简单的能方便我们调试程序的功能选项都没有打开,哎,我真的好菜啊,以后要好好学习了
^-^
chinesun 2003-09-02
  • 打赏
  • 举报
回复
sql="select * from data where (ID is null)"
rs.open sql,conn,1,1
rs.addnew
__________________
这三行你稍做调整:
sql="select * from data order by id desc"
rs.open sql,conn,3,3
rs.addnew
zhonggan 2003-09-02
  • 打赏
  • 举报
回复
Set Rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from data"
Rs.open sql,conn,1,3
rs.addnew
:
starboy1413 2003-09-02
  • 打赏
  • 举报
回复
你是不是禁用了脚本调试呀,在IE属性的工具里看看~
johnnywang1980 2003-09-02
  • 打赏
  • 举报
回复
不客气,多散点分吧。嘿嘿嘿。
coolXbai 2003-09-02
  • 打赏
  • 举报
回复
谢谢johnnywang1980(地鬼)提供的方法,我看到了错误提示了,谢了
我再改改,OK的话就散分
coolXbai 2003-09-02
  • 打赏
  • 举报
回复
都试过了,还是不行,还是有500错误
wolf004 2003-09-02
  • 打赏
  • 举报
回复
rs.open sql,conn,3,3
possible_Y 2003-09-02
  • 打赏
  • 举报
回复
rs.open sql,conn,1,1
----------------------> rs.open sql,conn,1,3
johnnywang1980 2003-09-02
  • 打赏
  • 举报
回复
IE——工具——INTERNET选项——高级里的“显示友好的错误信息”勾去掉,然后再看看报什么错。
甘泉123 2003-09-02
  • 打赏
  • 举报
回复
rs.open sql,conn参数
511214 2003-09-02
  • 打赏
  • 举报
回复
首先请确保你的conn.asp没问题
<!--#include file="conn.asp"-->

再检察你的数据库连接没问题
if Request.form("txtyouemail")="" then
youemail="无"
else
youemail=Request.form("txtyouemail")
end if
if Request.form("txtcontent")="" then
youidea="无"
else
youidea=Request.form("txtyoucontent")
end if
sql="select * from data where (ID is null)"
rs.open sql,conn,3,1
试试吧
snowcloud2002 2003-09-02
  • 打赏
  • 举报
回复
rs.open sql,conn,1,1

应该是这句的问题吧
改成rs.open sql,conn,1,3 试试

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧