本帖最后由 邪恶海盗 于 2012-10-16 15:22 编辑
回复 2# nmgwddj
根据帮助改的:
#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#NoTrayIcon;右下角不显示图标
$WinMain = GUICreate("XXX", 300, 100) ;创建主窗口
$btn3 = GUICtrlCreateButton("确定", 250, 7, 40, 20)
$comb1 = GUICtrlCreateCombo("标志1", 55, 8, 85, 18)
$comb2 = GUICtrlCreateCombo("标志2", 155, 8, 85, 18)
Local $hQuery, $hQuery2, $aRow, $aRow2, $sMsg1, $sMsg2
_SQLite_Startup()
ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF)
_SQLite_Open() ; 打开:内存:数据库
_SQLite_Exec(-1, "CREATE TABLE aTest (a,b,c);") ; CREATE a Table
_SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('c','2','World');") ; 插入数据
_SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('b','3','XX');") ; 插入数据
_SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Ha1lo');") ; 插入数据
_SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('c','1','Ha2lo1');") ; 插入数据
_SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','He3lo2');") ; 插入数据
_SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Heclo3');") ; 插入数据
_SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Heblo4');") ; 插入数据
_SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Halo5');") ; 插入数据
_SQLite_Exec(-1, "INSERT INTO aTest(a,b,c) VALUES ('a','1','Hdlo6');") ; 插入数据
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
;DirRemove($Temp, 1)
_SQLite_Close()
_SQLite_Shutdown()
Exit
Case $btn3
_SQLite_Query(-1, "SELECT c FROM aTest;", $hQuery)
While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
$sMsg1 &= StringLeft($aRow[0], 2) & "|"
WEnd
GUICtrlSetData($comb1, $sMsg1, "标志1")
Case $comb1
_SQLite_Query(-1, "SELECT c FROM aTest Where c like '%" & GUICtrlRead($comb1) & "%';", $hQuery2)
;_SQLite_Qury(-1, "SELECT * FROM 'aTest' WHERE 'a' like'%He%'", $hQuery) ; 查询
While _SQLite_FetchData($hQuery2, $aRow2) = $SQLITE_OK
$sMsg2 &= StringMid($aRow2[0], 3) & "|"
WEnd
;_SQLite_Exec(-1, "DROP TABLE aTest;") ; 删除表
GUICtrlSetData($comb2, $sMsg2, "标志2")
EndSwitch
WEnd
有人说用数据库地话体现不出效率,下一步尝试存储的时候分两例,这样就不需要用AU3拆字符了... |