怎么样先sqlite数据查询后建立表格,显示在listview上,在点击一个项后赋值到变量
本帖最后由 nangua111111 于 2013-3-31 21:35 编辑_SQLite_Query(-1,'create table "sjbd" as (select shuju1.&"1号"&,shuju1.&"2号&" FROM shuju1 INNER JOIN shuju2 ON shuju1."&3号&" = shuju2."&4号&" WHERE shuju1."&1号&" <> '&00000000&' AND shuju2."&3号&" <> "&888&"")')
这样写查询为何不行。
_SQLite_Startup()
$sql = _SQLite_Open(@ScriptDir & "\Database.db")
_SQLite_Query(-1,'create table "sjbd" as (select shuju1.&"1号"&,shuju1.&"2号&" FROM shuju1 INNER JOIN shuju2 ON shuju1."&3号&" = shuju2."&4号&" WHERE shuju1."&1号&" <> '&00000000&' AND shuju2."&3号&" <> "&888&"")',$sjbd)
_ArrayDisplay($sjbd, "sjbd")
While $vv=_SQLite_FetchData ($bdsj,$avArray)
GUICtrlCreateListViewItem ($avArray,$ListView1)
WEnd 我要的是两个数据的碰撞 ,也就是shuju1 和数据shuju2 两个表格共同包含一个内容的提取 create table "sjbd" as (selectshuju1.&"1号"&,shuju1.&"3号&" FROM shuju1,shuju2 where shuju1."&1号&" = shuju2."&3号&"and shuju1."&1号&" <> '&00000000&' AND shuju2."&3号&" <> "&888&"")
不知道这样对不对,还在研究查询结果显示到listview中 本帖最后由 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&"|"&$ONd&"|"&$ONd,$ListView);这个循环是怎么做到的$ONd
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语句没有写好的缘故 本帖最后由 kk_lee69 于 2013-3-28 09:26 编辑
http://www.autoitx.com/forum.php?mod=viewthread&tid=18052&highlight=sqlite
這裡不是有範例 回复 5# kk_lee69
就是参照出来的,但就是不明白 回复 5# kk_lee69
就是参照出来的,但就是不明白 本帖最后由 kk_lee69 于 2013-3-28 10:09 编辑
Func SQLiteRead()
_GUICtrlListView_DeleteAllItems ( GUICtrlGetHandle ($GUI_ListBox) )
_SQLite_Open ($SQLite_Data_Path)
_SQLite_Query(-1, "SELECT * FROM TestTable ORDER BY IDs DESC;",$hQuery)
While _SQLite_FetchData ($hQuery, $aRow) = $SQLITE_OK
_GUICtrlListView_AddItem($GUI_ListBox, $aRow)
_GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow), $aRow, 1)
_GUICtrlListView_AddSubItem($GUI_ListBox, _GUICtrlListView_FindInText($GUI_ListBox, $aRow), $aRow, 2)
WEnd
_SQLite_Close ()
EndFunc
根據上面 _SQLite_Open ($SQLite_Data_Path)
所以你試著把你原來的local $hmemDB = _SQLite_open($DB) 前面的 local $hmemDB = 拿掉看看 回复 8# kk_lee69
这样做还是不行,我再仔细看看。 回复 8# kk_lee69
谢谢,花了n天才有点进步。{:face (125):} While_SQLite_FetchData ($hQuery,$ONd)= $SQLITE_OK;这里不太明白, _SQLite_FetchData抓出来的好像是一维数据,
GUICtrlCreateListViewItem ($ONd&"|"&$ONd&"|"&$ONd,$ListView);这个循环是怎么做到的$ONd
WEnd
上面这几句能各位能解释一下吗。不太明白 求
能进化到点击listview显示的一个项目,后赋值到变量。
例如用鼠标点击ALABAMA ,相当于获取ALABAMA 这个值,然后赋值到变量
{:face (270):}
页:
[1]