Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
DRIVER={Microsoft Text Driver (*.txt; *.csv)};DefaultDir=C:\Data\MyDir;
Add -> 32
Delete -> 345
Add -> 1
->
[mydata.txt]
Format = TabDelimited
ColNameHeader = False
Col1 = Action Text
Col2 = DataValue Long
adOpenKeyset
<job>
<object id = oRS progid = "ADODB.Recordset"/>
<reference object = "ADODB.Recordset"/>
<script language = "VBScript">
Function ScriptPath()
Dim strSFN
strSFN = WScript.ScriptFullName
ScriptPath = Left(strSFN, InStrRev(strSFN, "\") - 1)
End Function
Dim sConn, sSource, sResults
Const cMyName = "Fetching Text Data With ADO"
sSource = "SELECT * FROM [mydata.txt]"
sConn = "DRIVER={Microsoft Text Driver (*.txt; *.csv)};" & _
"DefaultDir=" & ScriptPath & ";"
MsgBox "Records will be counted on your OK!", _
vbOkOnly, cMyName
'Use of adOpenKeyset is CRITICAL or RecordCount returns -1!
oRS.Open sSource, sConn, adOpenKeyset
MsgBox "File contains " & CStr(oRS.RecordCount) & _
" records.", vbOkOnly, cMyName
MsgBox "Data will be processed on your OK!", _
vbOkOnly, cMyName
sResults = ""
oRS.MoveFirst
Do
sResults = sResults & _
"Action: " & oRS.Fields("Action") & _
" Value: " & CStr(oRS.Fields("DataValue")) & _
vbNewLine
oRS.MoveNext
Loop Until oRS.EOF
MsgBox sResults, vbOkOnly, cMyName
oRS.Close
</script>
</job>
<job>
<object id = oRS progid = "ADODB.Recordset"/>
<reference object = "ADODB.Recordset"/>
<script language = "VBScript">
Function ScriptPath()
Dim strSFN
strSFN = WScript.ScriptFullName
ScriptPath = Left(strSFN, InStrRev(strSFN, "\") - 1)
End Function
Dim sConn, sSource, sResults
Const cMyName = "Fetching/Sorting Text Data With ADO"
sSource = "SELECT * FROM [mydata.txt]"
sConn = "DRIVER={Microsoft Text Driver (*.txt; *.csv)};" & _
"DefaultDir=" & ScriptPath & ";"
MsgBox "Records will be counted on your OK!", _
vbOkOnly, cMyName
oRS.CursorLocation = adUseClient 'Sorting.
'Use of adOpenKeyset is CRITICAL or RecordCount returns -1!
oRS.Open sSource, sConn, adOpenKeyset
MsgBox "File contains " & CStr(oRS.RecordCount) & _
" records.", vbOkOnly, cMyName
MsgBox "Data will be processed on your OK!", _
vbOkOnly, cMyName
sResults = ""
oRS.Sort = "DataValue ASC"
oRS.MoveFirst
Do
sResults = sResults & _
"Action: " & oRS.Fields("Action") & _
" Value: " & CStr(oRS.Fields("DataValue")) & _
vbNewLine
oRS.MoveNext
Loop Until oRS.EOF
MsgBox sResults, vbOkOnly, cMyName
oRS.Close
</script>
</job>
[code]
Happy scripting!