#include <GUIConstantsEx.au3>
#include <TreeViewConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
$mdb_data_pwd = "112233"
$Form1 = GUICreate("Form1", 204, 404, 193, 115)
$TreeView1 = GUICtrlCreateTreeView(40, 40, 121, 305)
$TreeView1_0 = GUICtrlCreateTreeViewItem("服务端游戏", $TreeView1)
$TreeView2_0 = GUICtrlCreateTreeViewItem("客户端游戏", $TreeView1)
$Button1 = GUICtrlCreateButton("Button1", 56, 368, 75, 25, 0)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_idclass1du($TreeView1_0,$TreeView1)
EndSwitch
WEnd
Func _idclass1du($TreeView1_0,$TreeView1)
GUICtrlSendMsg($TreeView1, $LVM_DELETEALLITEMS, 0, 0)
FileDelete(@ScriptDir & "\data\temp.dll")
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & @ScriptDir & "\data.mdb" & ";Jet Oledb:Database Password=" & $mdb_data_pwd)
$RS = ObjCreate("ADODB.Recordset")
$RS.ActiveConnection = $addfld
$RS.Open("Select * From class")
While Not $RS.eof And Not $RS.bof
If @error = 1 Then ExitLoop
$who1 = $RS.Fields(0).value
$who2 = $RS.Fields(1).value
$sintg1 = StringStripWS($who1, 8)
$sintg2 = StringStripWS($who2, 8)
IniWrite(@ScriptDir & "\data\temp.dll", "log", $sintg2, $sintg1)
GUICtrlCreateTreeViewItem($sintg2, $TreeView1_0)
GUICtrlCreateTreeViewItem($sintg2, $TreeView2_0)
$RS.movenext
WEnd
$RS.close
$addfld.Close
EndFunc
点按钮一次读一下 可以读出来 但是点一次以前的并没有消失 而是重复的读取出来了 很郁闷
附件为我的数据库和代码
[ 本帖最后由 kryiran 于 2008-8-21 10:15 编辑 ] |