文本文件的内容进行排序

2015-08-17 0 788
文本文件的内容进行排序
Dim objFSO,objFile,DataList,strText
Const adVarChar = 200 
Const MaxCharacters = 255 
Const ForReading = 1 
Const ForWriting = 2 

Set DataList = CreateObject("ADOR.Recordset") 
DataList.Fields.Append "ComputerName", adVarChar, MaxCharacters 
DataList.Open 

Set objFSO = CreateObject("Scripting.FileSystemObject") 
Set objFile = objFSO.OpenTextFile("C:ScriptsComputers.txt", ForReading) 

Do Until objFile.AtEndOfStream 
strLine = objFile.ReadLine 
DataList.AddNew 
DataList("ComputerName") = strLine 
DataList.Update 
Loop 

objFile.Close 

DataList.Sort = "ComputerName" 

DataList.MoveFirst 
Do Until DataList.EOF 
strText = strText & DataList.Fields.Item("ComputerName") & vbCrLf 
DataList.MoveNext 
Loop 

Set objFile = objFSO.OpenTextFile("C:ScriptsComputers.txt", ForWriting) 

objFile.WriteLine strText 
objFile.Close

遇见资源网 ASP/Basic 文本文件的内容进行排序 http://www.ox520.com/13522.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务