本帖最后由 chzj589 于 2016-11-5 10:54 编辑
SQLite 数据库如何多列与循环查询?
学习操作SQLite 数据库的读取、写入、修改、查询、Excel导入。
现在不能多列查询,
如SQLite 数据库有同样的数据,不能循环查询显示在ListView列表?
下面的代码如何修改?
Func _ButtonSelect()
$Strn1 = GUICtrlRead($GUI_InputName)
If $Strn1 = "" Then
MsgBox(0, "错误提示", "查询不能为空")
ThisInputClear()
Else
SQLiteSelect($TableName, $Name, GUICtrlRead($GUI_InputName))
EndIf
EndFunc ;==>_ButtonSelect
;输入参数:1。表名 2.记录名 3.记录的值
Func SQLiteSelect($TableName, $key, $keyValue)
If GUICtrlRead($GUI_InputName) = '' Then
MsgBox(48, "提示", "请输入搜索名称", 3)
Else
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($DListView1))
GUICtrlSendMsg($DListView1, $LVM_DELETEALLITEMS, 0, 0)
$readq19 = GUICtrlRead($GUI_InputName)
_SQLite_Open($SQLite_Data_Path)
_SQLite_QuerySingleRow(-1, "SELECT * FROM " & $TableName & " WHERE " & $key & " = '" & $keyValue & "';", $aRow)
_GUICtrlListView_AddItem($DListView1, $aRow[0])
_GUICtrlListView_AddSubItem($DListView1, _GUICtrlListView_FindInText($DListView1, $aRow[0]), $aRow[1], 1)
_GUICtrlListView_AddSubItem($DListView1, _GUICtrlListView_FindInText($DListView1, $aRow[0]), $aRow[2], 2)
_GUICtrlListView_AddSubItem($DListView1, _GUICtrlListView_FindInText($DListView1, $aRow[0]), $aRow[3], 3)
_GUICtrlListView_AddSubItem($DListView1, _GUICtrlListView_FindInText($DListView1, $aRow[0]), $aRow[4], 4)
_GUICtrlListView_AddSubItem($DListView1, _GUICtrlListView_FindInText($DListView1, $aRow[0]), $aRow[5], 5)
_GUICtrlListView_AddSubItem($DListView1, _GUICtrlListView_FindInText($DListView1, $aRow[0]), $aRow[6], 6)
_GUICtrlListView_AddSubItem($DListView1, _GUICtrlListView_FindInText($DListView1, $aRow[0]), $aRow[7], 7)
_GUICtrlListView_AddSubItem($DListView1, _GUICtrlListView_FindInText($DListView1, $aRow[0]), $aRow[8], 8)
_GUICtrlListView_AddSubItem($DListView1, _GUICtrlListView_FindInText($DListView1, $aRow[0]), $aRow[9], 9)
;MsgBox(262208, "查找结果...", "找到记录: 编号[" & $aRow[0] & "] 姓名[" & $aRow[1] & "] 年龄[" & $aRow[2] & "] !")
;#ce
EndIf
_SQLite_Close()
EndFunc ;==>SQLiteSelect
请kk_lee69 兄弟帮忙
问题己经解决!谢谢kk_lee69 兄弟 |