本帖最后由 nangua111111 于 2013-3-31 21:34 编辑
结果显示#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <WindowsConstants.au3>
#include <ie.au3>
#include <Array.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
$Form1 = GUICreate("获取数据", 438, 438, 192, 124)
$Button1 = GUICtrlCreateButton("Button1", 64, 32, 113, 49)
$ListView1 = GUICtrlCreateListView("", 40, 200, 361, 185)
_GUICtrlListView_AddColumn($ListView, "State ID ", 100)
_GUICtrlListView_AddColumn($ListView, "State Name ", 100)
_GUICtrlListView_AddColumn($ListView, "Tax ", 100)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Button1Click()
EndSwitch
WEnd
Global $Msg, $hQuery, $aRow
Func Button1Click()
_SQLite_startup()
if @error then
ConsoleWrite('error loading sqlite.dll' & @LF)
Exit
EndIf
$DB=@ScriptDir&"\Database.db"
local $hmemDB = _SQLite_open($DB)
if @error then
ConsoleWrite('Unable to open DB' & @LF)
Exit
EndIf
_SQLite_Query($DB, "SELECT * FROM Radio order by Tax;", $hQuery)
_ArrayDisplay($hQuery,'11111')
_SQLite_startup()
$DB=@ScriptDir&"\Database.db"
_sqlite_open($DB)
Global $hQuery, $aRow,$ONd
_SQLite_Query(-1, "SELECT * FROM Radio ;", $hQuery)
_GUICtrlListView_DeleteAllItems($ListView)
While _SQLite_FetchData ($hQuery,$ONd)= $SQLITE_OK;这里不太明白, _SQLite_FetchData抓出来的好像是一维数据,
GUICtrlCreateListViewItem ($ONd[0]&"|"&$ONd[1]&"|"&$ONd[2],$ListView);这个循环是怎么做到的$ONd[0]
WEnd
_SQLite_Close()
EndFunc
已经解决
;这句老是错误"C:\Users\ff\Downloads\????.au3" (45) : ==> ??????????.:
;_SQLite_Query($DB, "SELECT * FROM Radio order by Tax;", $hQuery)
;_SQLite_Query($DB, "SELECT * FROM Radio order by Tax;", ^ ERROR,数据库查询错误是由于listview语句没有写好的缘故 |