[已解决]取数据库中一列的最大值,数据取不出来,程序又不报错,请问哪里错了?谢谢
本帖最后由 xuanniao110 于 2016-5-5 17:04 编辑Func max()
$mdb_data_path = @ScriptDir & "\wfj.mdb"
$mdb_data_pwd = "123456"
$tblname = "wfj"
$adCol = "sx"
$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 MAX(" & $adCol & ") as maxvalue FROM " & $tblname )
While Not $RS.eof And Not $RS.bof
If @error = 1 Then ExitLoop
GUICtrlSetData($Input1,$RS.Fields (0).value)
$RS.movenext
WEnd
$RS.close
$addfld.Close
EndFunc ;==>max代码没有任何问题 留后人使用
页:
[1]