| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 457 人关注过本帖
标题:[求助]"溢出"是什么问题啊?
只看楼主 加入收藏
xieziyou
Rank: 1
等 级:新手上路
帖 子:40
专家分:0
注 册:2006-9-27
收藏
 问题点数:0 回复次数:1 
[求助]"溢出"是什么问题啊?

程序出错,显示器提示为:
错误类型
Microsoft VBScript 运行时错误 (0x800A0006)
溢出
poll_bar.asp, 第 44 行

-----这是什么问题啊?敬请指点,感谢!感谢!
*********************************************************************************************

<%
'定义用于从给定文件(只)读取票数的函数:
Function ReadCount(CFile)
Dim objFSO,objTS
Set objFSO=Server.CreateObject("Scripting.FileSystemObject")
Set objTS=objFSO.OpenTextFile(Server.MapPath(CFile),1,True) '1,为只读
If Not objTS.AtEndOfStream Then
ReadCount=CLng(objTS.ReadLine)
Else
ReadCount=0
End If
objTS.Close
Set objFSO= Nothing
End Function

'定义用于将累计票数(只)写入指定文件的sub过程:
Sub WriteCount(CFile,Count)
Dim objFSO,objTS
Set objFSO=Server.CreateObject("Scripting.FileSystemObject")
Set objTS=objFSO.OpenTextFile(Server.MapPath(CFile),2,True) '2,为只写
objTS.WriteLine(Count)
objTS.Close
Set objFSO= Nothing
End Sub
%>

<%
Dim Vote,London1,Paris1,Sanfran1,Repeat,Total
Dim PLondon,PParis,PSanfran
Dim WLondon,WParis,WSanfran

Application.Lock()
'获取浏览者所投票的城市:
Vote=Request("Vote")

'从相应文件分别读取各城市已获得的票数
London1=ReadCount("London.txt")
Paris1=ReadCount("Paris.txt")
Sanfran1=ReadCount("Sanfran.txt")

'计算投票总数,并分别计算各城市得票的百分比:
Total=London1+Paris1+Sanfran1
PLondon=London1/Total
PParis=Paris1/Total
PSanfran=Sanfran1/Total

'根据各城市的得票百分比分别计算横条图的宽度:
WLondon=300*PLondon
WParis=300*PParis
WSanfran=300*PSanfran

'限制重复投票
If (vote<>Empty)And(Session("Repeat")=London or Paris or Sanfran) Then
Response.Write("您已经投过票,不能重复投票!")
Response.End
Else
' 判断当前得票的城市,并为其票数加1后写入对应文件:
If Vote="London" Then
London1=London1+1
WriteCount"London.txt",London1
Session("Repeat")=London

ElseIf Vote="Paris" Then
Paris1=Paris1+1
WriteCount"Paris.txt",Paris1
Session("Repeat")=Paris

ElseIf Vote="Sanfran" Then
Sanfran1=Sanfran1+1
WriteCount"Sanfran.txt",Sanfran1
Session("Repeat")=Sanfran

End If
End If
Application.UnLock()
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>魅力城市网上投票</title>
</head>
<body><center>
魅力城市网上投票<p>
目前共计收到选票<%=Total%>张.最近投票结果更新时间:<%=now%></p>
<table width="500">
<tr>
<td width="105" rowspan="2"><a href="poll_bar.asp?Vote=London"><img src="../../img/London.jpg" width="102" height="104"></td>
<td width="45" rowspan="2">&nbsp;</td>
<td height="50" valign="bottom">伦敦得票:<%=London1%></td>
</tr>
<tr>
<td valign="middle"><img src="../../img/bar2.gif" width=<%=WLondon%>height="20">
<%=FormatPercent(PLondon)%></td>
</tr>
<tr>
<td width="105" rowspan="2"><a href="poll_bar.asp?Vote=Paris"><img src="../../img/Paris.jpg" width="101" height="104"></td>
<td width="45" rowspan="2">&nbsp;</td>
<td height="50" valign="bottom">巴黎得票:<%=Paris1%></td>
</tr>
<tr>
<td valign="middle"><img src="../../img/bar2.gif" width=<%=WParis%>height="20">
<%=FormatPercent(PParis)%></td>
</tr>
<tr>
<td width="105" rowspan="2"><a href="poll_bar.asp?Vote=Sanfran"><img src="../../img/Sanfran.jpg" width="104" height="93"></td>
<td width="45" rowspan="2">&nbsp;</td>
<td height="50" valign="bottom">旧金山得票:<%=Sanfran1%></td>
</tr>
<tr>
<td valign="middle"><img src="../../img/bar2.gif" width=<%=WSanfran%>height="20">
<%=FormatPercent(PSanfra)%></td>
</tr>
</table>
</center></body>
</html>

搜索更多相关主题的帖子: Microsoft 显示器 color 
2007-02-04 21:56
yms123
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:209
帖 子:12488
专家分:19042
注 册:2004-7-17
收藏
得分:0 

溢出最可能的原因就是,内存处理量过大,导致内存溢出而程序错误。
依照楼主的程序最可能的原因就是文件的数据量可能过大。

2007-02-06 15:52
快速回复:[求助]"溢出"是什么问题啊?
数据加载中...
 
   



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

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