關於朱泰銓-個人資料



[ASP.NET]簡易的讀取/寫入txt文字檔操作

有時候我們會用到記錄資料的功能

但也許資料非常的小巧且對安全性不要求

比方說,今日瀏覽人數之類的

(當然若這些資料需要做分析性報表則不適合存在文字檔中)

那如果這些資料存在資料庫會不會太大材小用?

因此我們一般是存在txt文字檔當中…

一來加快讀取的速度,一來要求的基本空間跟條件也較小

而在ASP.NET中,讀取跟寫入文字檔是非常容易的,快速的兩行即可解決

讀取:

FileOpen(1, Server.MapPath(『howmuch.txt』), OpenMode.Input)
test = LineInput(1)

寫入:

FileOpen(1, Server.MapPath(『howmuch.txt』), OpenMode.Output)
Print(1, value)

對於簡單的小巧資料,用這種方式既快速且方便~

2 comments to [ASP.NET]簡易的讀取/寫入txt文字檔操作

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>