本帖最后由 121044246 于 2014-4-18 10:00 编辑
求教读取access某字段所有数值,怎么样求和呢?
已解决,谢谢各位的热心回复 $total += $RS.Fields(6).value;逐行相加;~ $tblname = GUICtrlRead($maijia)
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_data_path)
$RS = ObjCreate("ADODB.Recordset")
$RS.ActiveConnection = $addfld
$RS.open("SELECT * FROM " & $tblname & " WHERE 金额")
Local $total = 0 ;总和
While Not $RS.eof And Not $RS.bof
If @error = 1 Then ExitLoop
$total += $RS.Fields(6).value;逐行相加
$RS.movenext
WEnd
$RS.close
$addfld.close
|