用过access数据库的操作,觉得还是access数据库操作简单,如下是循环读取所以数据的操作,供参考$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_data_path & ";Jet Oledb:Database Password=" & $mdb_data_pwd)
$RS = ObjCreate("ADODB.Recordset")
$RS.ActiveConnection = $addfld
$RS.Open("Select MachineName,PCName,IPaddress,MachineStatus,SoftwareRev,ClientRev,MacAddress,UpdateDateTime From " & $tblname & " Where Machinetype = 'Swage'")
While Not $RS.eof And Not $RS.bof
If @error = 1 Then ExitLoop
$arrayOfdata = _DataToArray($row - 1, $RS.Fields(0).value, $RS.Fields(1).value, $RS.Fields(2).value, $RS.Fields(3).value, $RS.Fields(4).value, $RS.Fields(5).value, $RS.Fields(6).value, $RS.Fields(7).value)
_ExcelWriteArray($oExcel, $row, 1, $arrayOfdata, 0)
$row += 1
$RS.movenext
WEnd
$RS.close
|