sol13-19.vbs

来自「Apress - Managing Enterprise Systems Wit」· VBS 代码 · 共 21 行

VBS
21
字号
Set objCmd = CreateObject("ADODB.Command")
'check if script is run using Wscript or Cscript
   If StrComp(Right(Wscript.Fullname,11),"cscript.exe", vbTextCompare) <>0 Then 
Wscript.Echo "This script is best run using Cscript.exe"
    Wscript.Quit
   End If

objCmd.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _ 
            "Data Source=D:\data\Access\Samples\Northwind.mdb"
objCmd.CommandText = "[Employee Sales by Country]" 'set the query

'execute the command, passing an array of parameters to it.
Set objRst = objCmd.Execute(, Array(#1/1/1996#, #12/12/1996#))

While Not objRst.EOF
Wscript.Echo objRst("ShippedDate") & " " & objRst("SaleAmount")
objRst.MoveNext
Wend

objRst.Close

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?