高分求助,帮忙看一段ASP中的VB查询语句。。。。。。

来源:百度知道 编辑:UC知道 时间:2024/06/17 11:26:22
首先说明一下:
我想要查询E:\Inetpub\wwwroot\styb\styb.txt这个文件里的内容,然后用marquee字幕调用出来。

以下有一段代码,虽然可以正常显示,但是很明显里面的查询语句有一部分属于冗余代码,麻烦帮我把这段代码清理一下,只需要留下查询styb.txt这个文件就可以。

也就是说,我不需要判断另外几个文件(如:fo3122oo.bnc等)是否存在,而直接查询styb.txt。

<%
dim yb,myb,rs,temp,n,n1morning,n1
set yb=server.createobject("scripting.filesystemobject")
n1 = right(date(),2)
temp= n1-1
morning="fo"&temp&"22oo.bnc"
morning="E:\Inetpub\wwwroot\styb\"&morning
n="fo"&right(date(),2)&"04oo.bnc"
n="E:\Inetpub\wwwroot\styb\"&n
if left(right(date(),2),1)="-" then
n1=right(date(),1)
temp="0"&(n1-1)
morning="fo"&temp&"22oo.bnc"
morning="E:\Inetpub\wwwroot\styb\"&morning
n="fo0"&right(date(),1)&"04oo.bnc"
n="E:\In

这是按照你的要求删除的最简单的,如果要额外增加检查文件是否存在的脚本的话,一楼的那个版本就可以了。
<%
dim yb,myb,rs
set yb=server.createobject("scripting.filesystemobject")
set myb=yb.opentextfile("E:\Inetpub\wwwroot\styb\styb.txt")
rs=myb.readall
%>

<marquee direction="up" onmouseout="this.start()" onmouseover="this.stop()" scrollAmount="2" width="320" height="90">
<span style="font-size:9pt;line-height:14pt">
<% response.write rs%>
</span></marquee>

<%
dim myb,rb,rs
rs=""
set yb=server.createobject("scripting.filesystemobject")
if yb.fileexists("E:\Inetpub\wwwroot\styb\styb.txt") then
set myb=yb.opentextfile("E:\Inetpub\wwwroot\styb\styb.txt")
rs=myb.readall
end if
%>

<marquee directi