Posted By

qrist0ph on 09/16/08


Tagged

vbs


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

jeffld


VBS Recordset


 / Published in: Visual Basic
 

  1. Const ForReading = 1
  2. Const adVarChar = 200
  3. Const MaxCharacters = 255
  4. Const adDouble = 5
  5.  
  6. Set DataList = CreateObject("ADOR.Recordset")
  7. DataList.Fields.Append "Player", _
  8. adVarChar, MaxCharacters
  9. DataList.Fields.Append "HomeRuns", adDouble
  10. DataList.Open
  11.  
  12. Set objFSO = _
  13. CreateObject("Scripting.FileSystemObject")
  14. Set objFile = objFSO.OpenTextFile _
  15. ("C:\Scripts\Test.txt", ForReading)
  16.  
  17. objFile.SkipLine
  18.  
  19. Do Until objFile.AtEndOfStream
  20. strStats = objFile.ReadLine
  21. arrStats = Split(strStats, vbTab)
  22.  
  23. DataList.AddNew
  24. DataList("Player") = arrStats(0)
  25. DataList("HomeRuns") = arrStats(1)
  26. DataList.Update
  27. Loop
  28.  
  29. objFile.Close
  30.  
  31. DataList.MoveFirst
  32.  
  33. Do Until DataList.EOF
  34. Wscript.Echo _
  35. DataList.Fields.Item("Player") & _
  36. vbTab & _
  37. DataList.Fields.Item("HomeRuns")
  38. DataList.MoveNext
  39. Loop

Report this snippet  

You need to login to post a comment.