Asp讀取文本文件并顯示_ASP教程
推薦:asp怎樣利用InstrRev()獲取文件名InstrRev函數(shù),從字符串的最后一個(gè)搜索起,前面字符串。 % Dim strTXT,pos strTXT=www.webjx.com pos=instrRev(strTXT,.) Response.Write pos % 我們搜索的起始是倒序,從com前的一個(gè)點(diǎn)。起始的字符的長(zhǎng)度,含此點(diǎn),共十個(gè)字符,返回的結(jié)果將是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" ’缺省相對(duì)路徑是c:winnt
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filename)
Set readf = f.OpenAsTextStream(ForReading,TristateFalse)
’第一個(gè)參數(shù)可選。輸入/輸出模式,是下列三個(gè)常數(shù)之一:
’ ForReading=1只讀、ForWriting=2 可讀寫或 ForAppending=3追加
’第二個(gè)參數(shù)也為可選。三個(gè) Tristate 值之一,
’ 指出以何種格式打開文件。忽略此參數(shù),則文件以 ASCII
’格式打開。 TristateUseDefault=-2 以系統(tǒng)默認(rèn)格式打開文件、
’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子句速度快的模糊查詢語法一般來說使用模糊查詢,大家都會(huì)想到LIKE select * from table where a like '%字符%' 如果一個(gè)SQL語句中用多個(gè) like模糊查詢,并且記錄條數(shù)很大,那速度一定會(huì)很慢。 下面兩種方法也可實(shí)現(xiàn)模糊查詢: select * from table where patindex('%字符%',a)0 sele
- asp FSO 讀寫文件本文件實(shí)現(xiàn)代碼
- asp中isNull、isEmpty和空字符串的區(qū)別
- asp獲取用戶真實(shí)IP地址的方法
- asp連接sqlserver數(shù)據(jù)庫(kù)實(shí)現(xiàn)代碼
- asp中正則表達(dá)式過濾html代碼函數(shù)
- asp中g(shù)et post提交表單區(qū)別
- 網(wǎng)頁模板:ASP內(nèi)建對(duì)象Request
- xmlhttp的open方法使用詳解
- ASP的常用的自定義函數(shù)大全
- asp中用for循環(huán)的一個(gè)小技巧
- eWebEditor v3.8 列目錄
- ASP無組件分頁實(shí)現(xiàn)思路及代碼
- 相關(guān)鏈接:
- 教程說明:
ASP教程-Asp讀取文本文件并顯示
。