回复 8# qsy666888
用你另一个帖子的数据库来做例子.#Include <GuiListView.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
_SQLite_Startup ()
$SQLite_Data_Path = "SQLite.db"
$Tablekj = "kaojuan"
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("从数据库里获取姓名示例", 478, 412, 481, 210)
GUISetFont(11, 400, 0, "宋体")
Global $ListView1 = GUICtrlCreateListView("序号|姓名|语文", 8, 8, 458, 358)
KC_lvdraw()
Global $Button1 = GUICtrlCreateButton("查看分数", 293, 376, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
Exit
Case $Button1
msgbox(0,"70多分者", _get_N(7, 1))
msgbox(0,"分数个位数是5者", _get_N(5, 0))
EndSwitch
WEnd
Func _get_N($iNum, $iCode = 1)
Local $aRow, $hQuery, $sMsg = ''
Local $sQuery
If $iCode Then
$sQuery = "'" & $iNum & "%'"
Else
$sQuery = "'%" & $iNum & "'"
EndIf
_SQLite_Open ($SQLite_Data_Path)
_SQLite_Query(-1, "SELECT * FROM kaojuan WHERE 分数 LIKE " & $sQuery & ";", $hQuery)
While _SQLite_FetchData($hQuery, $aRow) = $sqlite_ok
$sMsg &= $aRow[0] & @TAB & $aRow[1] & @CRLF
WEnd
Return $sMsg
EndFunc
Func KC_lvdraw()
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1))
Local $Irval, $Aresult, $Irows, $Icolumns
$Irval = _SQLite_GetTable2d( _SQLite_Open ($SQLite_Data_Path), "select rowid,* from kaojuan;", $Aresult, $Irows, $Icolumns)
_ArrayDelete($aresult, 0)
_GUICtrlListView_AddArray($ListView1, $Aresult)
EndFunc
|