break on
; Change these to your specifics ...
$source= "data source=\\dn1cov\shawn\msaccess\app.mdb; provider=microsoft.jet.oledb.4.0;"
$table= "app"
$sql= "select appname, commandline, snapname from app;"
$delim= ";"
$cnnobj= "adodb.connection"
$rstobj= "adodb.recordset"
$cnn = olecreateobject ( "$cnnobj" )
if @error
?"Error creating object $cnbobj."
?"@serror"
quit(0)
endif
$= olecallfunc ( $cnn, "open", "s", "$source" )
if @error
?"Error connecting to datasource."
?"@serror"
quit(0)
endif
$rst = olecreateobject ( "$rstobj" )
if @error
?"Error creating object $rstobj."
?"@serror"
quit(0)
endif
$xcnn= dectohex ($cnn)
$= olecallfunc ( $rst, "open", "so", "$sql", "$xcnn" )
if @error
?"Error opening recordset."
?"@serror"
quit(0)
endif
$rec = olecallfunc ( $rst, "GetString", "sss", "2", "1","$delim" )
while @error = 0
; parse out the fields ...
$rec=$rec+"$delim"
$pos= instr("$rec","$delim")
$appname= substr("$rec",1,$pos-1)
$rec= substr($rec,$pos+1,len($rec))
$pos= instr("$rec","$delim")
$commandline= substr("$rec",1,$pos-1)
$rec= substr($rec,$pos+1,len($rec))
$pos= instr("$rec","$delim")
$snapname= substr("$rec",1,$pos-1)
$rec= substr($rec,$pos+1,len($rec))
?
?"AppName: $appname"
?"CommandLine: $commandline"
?"Snapname: $snapname"
$rec = olecallfunc ( $rst, "GetString", "sss", "2", "1", "$delim" )
loop
:finish
; object cleanup ...
if $rst
$rs = olereleaseobject ( $rst )
endif
if $cnn
$rs = olereleaseobject ( $cnn )
endif
exit