'create and open database connection
Dim c
set c = CreateObject("ADODB.Connection")
c.Open "connection string goes here"
'prepare shell object to run command statements
Dim objShell
Set objShell = CreateObject("WScript.Shell")
dim r
set r = c.Open("select col1, col2, col3 ... from yourtable ")
while not r.eof
Dim strCol1
Dim intCol2
Dim datCol3
'get the field values
strCol1 = r.Fields("Col1").value
intCol1 = r.Fields("col2").value
datCol1 = r.Fields("col3").value
'here shall come the code to run the command you need ...
objShell.Run("your command goes here")
' get to the next record, if any
r.movenext
wend
r.close
c.close
|