主頁 > 知識庫 > 利用AdoDb.Stream對象來讀取UTF-8格式的文本文件

利用AdoDb.Stream對象來讀取UTF-8格式的文本文件

熱門標(biāo)簽:武夷山旅游地圖標(biāo)注 鳳臺百度地圖標(biāo)注店 個人可以辦理400電話么 縣域地圖標(biāo)注打印店 萊西電子地圖標(biāo)注 金昌電話機(jī)器人價格 修改地圖標(biāo)注 外呼系統(tǒng)API接口 怎么在地圖標(biāo)注自己
復(fù)制代碼 代碼如下:

'函數(shù)名稱:ReadTextFile
    '作用:利用AdoDb.Stream對象來讀取UTF-8格式的文本文件
    '----------------------------------------------------
    Function ReadFromTextFile (FileUrl,CharSet)
        If FileUrl = "" OR IsNull(FileUrl) Then
            ReadFromTextFile = ""
            Exit Function
        End If
        If Not FLib.IsReallyPath(FileUrl) Then
            FileUrl = Server.MapPath(FileUrl)
        End If
        dim str, stm
        set stm=server.CreateObject("adodb.stream")
        stm.Type=2 '以本模式讀取
        stm.mode=3 
        stm.charset=CharSet
        stm.open
        stm.loadfromfile FileUrl
        str=stm.readtext
        stm.Close
        set stm=nothing
        ReadFromTextFile=str
    End Function
    '-------------------------------------------------
    '函數(shù)名稱:WriteToTextFile
    '作用:利用AdoDb.Stream對象來寫入UTF-8格式的文本文件
    '----------------------------------------------------
    Function WriteToTextFile (FileUrl,byval Str,CharSet)   
        If FileUrl = "" OR IsNull(FileUrl) Then
            WriteToTextFile = ""
            Exit Function
        End If
        If Not FLib.IsReallyPath(FileUrl) Then
            FileUrl = Server.MapPath(FileUrl)
        End If
        Dim stm
        set stm=server.CreateObject("adodb.stream")
        stm.Type=2 '以本模式讀取
        stm.mode=3
        stm.charset=CharSet
        stm.open
        stm.WriteText str
        stm.SaveToFile FileUrl,2    
        stm.flush
        stm.Close
        set stm=nothing
    End Function

標(biāo)簽:上海 通遼 邢臺 清遠(yuǎn) 楚雄 涼山 南京 赤峰

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《利用AdoDb.Stream對象來讀取UTF-8格式的文本文件》,本文關(guān)鍵詞  利用,AdoDb.Stream,對象,來,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《利用AdoDb.Stream對象來讀取UTF-8格式的文本文件》相關(guān)的同類信息!
  • 本頁收集關(guān)于利用AdoDb.Stream對象來讀取UTF-8格式的文本文件的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章