sol13-8.vbs
来自「Apress - Managing Enterprise Systems Wit」· VBS 代码 · 共 19 行
VBS
19 行
Dim objConn, objRst, nTotal
Set objConn = CreateObject("ADODB.Connection")
'open a connection to a text file using a DSN
'the ODBC DSN is defined in Solution 13-1.
objConn.Open "SalesCSV"
'select all data from the text file Orders data.txt
Set objRst = objConn.Execute("Select * From [Orders data.txt]")
'loop through and total the contents
While Not objRst.EOF
nTotal = nTotal + objRst("SalesTotal").Value
objRst.MoveNext
Wend
Wscript.Echo "Total sales is:" & nTotal
'close the connection and recordset object
objRst.Close
objConn.Close
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?