;~ $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;逐行相加
;~ MsgBox(64,"每行的金额",$RS.Fields(6).value);想把每行的金额相加求和,要怎样写呢?
;~ $RS.movenext
;~ WEnd
;~ MsgBox(64,"总和",$total);显示总和
;~ $RS.close
;~ $addfld.close
|