新菜鸟新问题,请高手帮我看一下程序!!!

huangsizhong214 2005-03-31 11:40:29
我刚学ASP不久,自己弄了个留言板,运行时第51行出现类型不匹配错误,自己看了半天也没觉得有什么不对
请各位高手帮我看一下程序,是不是有什么地方编错了,谢谢!

有两个文件:Global.asa和AspChat.asp

Global.asa代码:
<Script language="VBScript" runat="server">
Sub Application_OnStart
Dim maChats(15)
Application("gaChats")=maChats
Application("giCounter")=0
End Sub
</Script>

AspChat.asp代码:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
body {
background-color: #0099CC;
}
.tit {
font-family: "隶书";
font-size: 36px;
color: #336666;
text-align: center;
}
.frm {
font-family: "宋体";
font-size: 18px;
color: #000000;
text-align: center;
}
-->
</style>
</head>
<!--#include file="Global.asa"-->
<body class="tit">
<p>网上留言板</p>


<hr align="center" size="1" noshade>
<% If request.ServerVariables("REQUEST_METHOD")="post" Then
if len(request("txtWho"))>0 then
session("ssWho")=request("txtWho")
end if
application.Lock()
mlCounter=Application("giCounter")
maChats=Application("gaChats")
if mlCounter>9 then
mlCounter=0
end if
maChats(mlCounter)= session("ssWho")&":"& request("txtCents")
mlCounter=mlCounter+1
application("giCounter")=mlCounter
Application("gaChats")=maChats
Application.UnLock()
End If %>

<% 'dim lstemp
if application("giCounter")=0 then
lstemp=Application("gaChats")(0)
else
for x=0 to application("giCounter")-1
lstemp=lstemp&"<br>"&Application("gaChats")(x)
next
end if
Response.Write lstemp
%>
<hr size="1" noshade>


<form action="AspChat.asp" method="post" name="frmasp" id="frmasp">
<table width="94%" border="1" cellspacing="0" cellpadding="0" bordercolor="#336699">
<tr align="center" bgcolor="#FFFFCC">
<td width="22%" class="frm">留言内容</td>
<td width="78%"> 
<textarea name="txtCents" cols="50" id="txtCents"></textarea></td>
</tr>
<tr bgcolor="#CCFF99">
<td align="center" class="frm">留言者姓名</td>
<td> 
<input name="txtWho" type="text" id="txtWho" value="<%=Session("ssWho") %>" size="40"> </td>
</tr>
<tr bgcolor="#FFFFCC">
<td height="28" colspan="2" align="center" class="frm"><input type="submit" name="Submit" value="提交留言信息"></td>
</tr>
</table>
</form>



</body>
</html>
...全文
49 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
lstup 2005-04-01
  • 打赏
  • 举报
回复
if Cint(application("giCounter"))=0 then

正解。没有把类型转换过来。
huangsizhong214 2005-03-31
  • 打赏
  • 举报
回复
顺便再问一下,数据库的ODBC已经设好
用Dreamweaver MX 连接数据库时 按下[+]/[数据源名称(DSN)]进行设置好,
单击测试 弹出"发现一个未知名的错误"对话框,找了好几本书都没有这方面的内容
请各位高手解答一下,谢谢!!!
spec_lc 2005-03-31
  • 打赏
  • 举报
回复
<% 'dim lstemp
if Cint(application("giCounter"))=0 then
lstemp=Application("gaChats")(0)
else
for x=0 to Cint(application("giCounter"))-1
lstemp=lstemp&"<br>"&Application("gaChats")(x)
next
end if
Response.Write lstemp
%>

28,406

社区成员

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

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