关于SQL语句的操作问题
Func _sel_all()GUICtrlSendMsg($ListView1, $LVM_DELETEALLITEMS, 0, 0)
$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 "&$T & " From " & $tblname )
while Not $RS.eof And Not $RS.bof
if @error =1 Then ExitLoop
GUICtrlCreateListViewItem ( $RS.Fields (0).value&"|"&$RS.Fields (1).value&"|"& $RS.Fields (2).value&"|"& $RS.Fields (3).value&"|"&$RS.Fields (4).value,$ListView1 ) ——>这里报错
$rs.movenext
WEnd
$rs.close
$addfld.Close
EndFunc
Func _test()
$addfld = ObjCreate("ADODB.Connection")
$RS =ObjCreate("ADODB.Recordset")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &$mdb_data_path& ";Jet Oledb:Database Password=" & $mdb_data_pwd)
$RS.ActiveConnection = $addfld
$RS.open ("Select sum(mo) From " & $tblname )
While Not $RS.eof And Not $RS.bof
$t=$RS.Fields (0).value
GUICtrlSetData($sum_input,$t)
$rs.movenext
WEnd
$rs.close
$addfld.Close
EndFunc
程序流程是 先执行_test() 后执行_sel_all()
个人觉得 这个查询 $RS.open ("Select sum(mo) From " & $tblname ) 影响后面的的取值
求高手解决
页:
[1]