推荐:asp怎样利用InstrRev()获取文件名
InstrRev函数,从字符串的最后一个搜索起,前面字符串。 % Dim strTXT,pos strTXT=www.webjx.com pos=instrRev(strTXT,.) Response.Write pos % 我们搜索的起始是倒序,从com前的一个点。起始的字符的长度,含此点,共十个字符,返回的结果将是9。 通过
<html> <head> <http-equiv="Content-Type" content="text/html; charset=gb2312"> <title></title> </head> <body> <% LANGUAGE = VBScript % > <% Const ForReading = 1, ForWriting = 2, ForAppending = 8 Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0 Dim filename filename = "test.txt" ’缺省相对路径是c:winnt Set fs = CreateObject("Scripting.FileSystemObject") Set f = fs.GetFile(filename) Set readf = f.OpenAsTextStream(ForReading,TristateFalse) ’第一个参数可选。输入/输出模式,是下列三个常数之一: ’ ForReading=1只读、ForWriting=2 可读写或 ForAppending=3追加 ’第二个参数也为可选。三个 Tristate 值之一, ’ 指出以何种格式打开文件。忽略此参数,则文件以 ASCII ’格式打开。 TristateUseDefault=-2 以系统默认格式打开文件、 ’TristateTrue=-1 以 Unicode 格式打开文件或TristateFalse=0 ’以 ASCII 格式打开文件。 ’也可用OpenTextFile方法打开文件
s = readf.ReadLine Do While readf.AtEndOfLine <> True s = readf.ReadLine Response.write s & "" ’逐行读文件并写出 Loop readf.close %> </body> </html>
|
分享:一种比like子句速度快的模糊查询语法
一般来说使用模糊查询,大家都会想到LIKE select * from table where a like '%字符%' 如果一个SQL语句中用多个 like模糊查询,并且记录条数很大,那速度一定会很慢。 下面两种方法也可实现模糊查询: select * from table where patindex('%字符%',a)0 sele