| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 684 人关注过本帖
标题:各位大哥帮我看看这段程序~~~~
取消只看楼主 加入收藏
deamonchan
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2005-9-5
收藏
 问题点数:0 回复次数:3 
各位大哥帮我看看这段程序~~~~

这是一段下载信息文件的程序,但是一运行出现了以下错误:

图片附件: 游客没有浏览图片的权限,请 登录注册
请问这是为什么?能否帮帮小弟?!感激中~~~~~~~~ <!--#include virtual="/Conn.asp"--> <% Class OutPutWord public sFileName '文件名 public sWordContent '@内容 Private adTypeBinary,pvFileName,svFileName '随机名称,'绝对名称 Private objStream,thefile,fso Private Sub Class_Initialize() adTypeBinary = 1 End Sub Private function WriteTxtfile(thedatafile,texts) on error resume next set fso=server.CreateObject("scripting.filesystemobject") set thefile=fso.CreateTextFile (thedatafile) thefile.write(texts) thefile.close set thefile=nothing set fso=nothing end function Private function getRand() Randomize '初始化随机数生成器。 p1=1000 p2=9999 getRand = INT((p2-p1 + 1)*RND+p1) end function Public function OutAction() pvFileName = "/Word/" & year(now) & "-" & month(now) & "-" & day(now) & "-" & getRand()&".doc" svFileName = Server.Mappath(pvFileName) Call WriteTxtfile(svFileName,sWordContent) Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Type = adTypeBinary objStream.LoadFromFile svFileName 'change the path if necessary Response.ContentType = "application/octet-stream" Response.AddHeader "Content-Disposition", "attachment; filename=" & sFileName & ".doc" '如果文件名固定,那就直接filename=文件名.doc,这个名字就是用户选“保存”时,出现的名字 Response.BinaryWrite objStream.Read Response.Flush objStream.Close Set objStream = Nothing '写完,释放对象 Call DelFile(svFileName) end function Private function DelFile(FilePath) Set fso = Server.CreateObject("Scripting.FileSystemObject") If fso.FileExists(FilePath) Then fso.DeleteFile(FilePath) End If Set fso=Nothing end function End Class

' dim myWord ' set myWord = new OutPutWord ' myWord.sFileName = "导出" ' myWord.sWordContent="硒鼓可耕地"&chr(13)&"a大草原" ' myWord.OutAction()

if Session("UserLogin")<>true then Call ScriptRedircet("你还没登陆,请登陆!","/") end if

ClassID = Trim(Request("ClassID")) p = Trim(Request("p")) dim strContent strContent = "" if ClassID = "已阅读未回复" then Set rsC=Server.CreateObject("Adodb.RecordSet") sql=" SELECT TOP 10 A.UserName, B.XinXiBiaoTi,B.XinXiNeiRong, B.TimeDate " & _ " FROM MyData_26 A INNER JOIN " & _ " MyData_52 B ON A.ID = B.TopID " & _ " WHERE (B.IsChaKan = 1) AND (B.ShouXinRen = "&Session("UserNameID")&") AND (B.XinXiBiaoTi <> N'系统消息') AND (B.ReturnID = 0) AND " & _ " (B.SelfDo = 0) " & _ " ORDER BY B.TimeDate" rsC.open sql,conn,1,3 if not rsC.eof then do while not rsC.eof strContent = strContent & "时间:" & rsC("TimeDate") & vbCrLf & _ "网友:" & rsC("UserName") & vbCrLf & _ "标题:" & rsC("XinXiBiaoTi") & vbCrLf & _ "内容:" & rsC("XinXiNeiRong")& vbCrLf & vbCrLf rsC.movenext loop else strContent = "暂无信息!" end if rsC.close set rsC = nothing if p = "0" then SQL = "Delete from MyData_52 where (IsChaKan = 1) AND (ShouXinRen = "&Session("UserNameID")&") AND (XinXiBiaoTi <> N'系统消息') AND (ReturnID = 0) AND (SelfDo = 0) " Conn.execute(SQL) end if End if

dim myWord set myWord = new OutPutWord myWord.sFileName = Session("UserName")&"的信息导出" myWord.sWordContent = strContent myWord.OutAction() %>

搜索更多相关主题的帖子: function include public 
2005-09-22 12:43
deamonchan
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2005-9-5
收藏
得分:0 
不是吧~~~~~怎么都没人来帮我啊?
2005-09-23 12:33
deamonchan
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2005-9-5
收藏
得分:0 
我晕了,呵呵,最近是不是都没人来解决问题了?还是没有人知道这个啊?一点消息都没有啊?可能我问题比较白痴,但是我真的不动嘛,你们也不能这么歧视能力低下的人啊~~~~~~``斑竹都没来回个帖`~~~~~~`唉,第一次碰到这么不友好的论坛
2005-09-24 11:59
deamonchan
Rank: 1
等 级:新手上路
帖 子:56
专家分:0
注 册:2005-9-5
收藏
得分:0 
提示: 该帖被管理员或版主屏蔽
2005-10-05 00:03
快速回复:各位大哥帮我看看这段程序~~~~
数据加载中...
 
   



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

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