如何在ACESS中做多重查询?
本帖最后由 pizigao 于 2009-12-21 08:28 编辑我现在只做到一个查询方式~其他项目不知道如何插入~请大家帮忙! #include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$datename = @ScriptDir & "\data.mdb"
If not FileExists($datename) then Exit (Msgbox(16,'错误','未找到DATA.MDB文件,请检查文件名和路径'))
$datepass = "GSDKDJV1200Jdls2008"
#Region ### START Koda GUI section ### Form=申报信息查看工具.kxf
$Form1_1 = GUICreate("申报信息查看工具", 321, 232, 272, 151)
GUISetCursor (5)
$Label1 = GUICtrlCreateLabel("申报月份", 17, 19, 52, 17)
$Label2 = GUICtrlCreateLabel("扣缴义务人编码", 17, 167, 88, 17)
$Label3 = GUICtrlCreateLabel("企业名称", 17, 198, 52, 17)
$Label4 = GUICtrlCreateLabel("申报用户", 17, 50, 52, 17)
$Label5 = GUICtrlCreateLabel("申报时间", 17, 136, 52, 17)
$Label6 = GUICtrlCreateLabel("申报标志", 17, 79, 52, 17)
$Label7 = GUICtrlCreateLabel("申报反馈", 17, 108, 52, 17)
$Label8 = GUICtrlCreateLabel("扣款反馈", 188, 19, 52, 17)
$Label9 = GUICtrlCreateLabel("申报方式", 188, 50, 52, 17)
$Label10 = GUICtrlCreateLabel("反馈方式", 188, 79, 52, 17)
$Label11 = GUICtrlCreateLabel("申报类型", 188, 108, 52, 17)
$Label12 = GUICtrlCreateLabel("申报次数", 222, 136, 52, 17)
$Button1 = GUICtrlCreateButton("查 询", 140, 13, 43, 25, 0)
$kjywrbm = GUICtrlCreateInput("", 106, 165, 145, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$qymc = GUICtrlCreateInput("", 72, 195, 209, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$sbfk = GUICtrlCreateInput("", 71, 104, 89, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$sbcs = GUICtrlCreateInput("", 276, 133, 25, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$sbsj = GUICtrlCreateInput("", 71, 133, 121, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$sbbz = GUICtrlCreateInput("", 71, 75, 57, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$sbyh = GUICtrlCreateInput("", 71, 45, 57, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$sbfs = GUICtrlCreateInput("", 244, 45, 57, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$kkfk = GUICtrlCreateInput("", 244, 16, 57, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$fkfs = GUICtrlCreateInput("", 244, 75, 57, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$sblx = GUICtrlCreateInput("", 244, 104, 57, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$sbrq = GUICtrlCreateCombo("", 71, 16, 65, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
rq()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
cx()
EndSwitch
WEnd
Func rq()
$addfld = ObjCreate("ADODB.Connection")
$RS = ObjCreate("ADODB.Recordset")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & $datename & ";Jet Oledb:Database Password=" & $datepass)
$RS.ActiveConnection = $addfld
$jy = "select sbyf from sbzb"
$RS.Open($jy)
$data = ""
While (Not $RS.eof And Not $RS.bof)
$data &= $RS.Fields(0).value & "|"
$RS.movenext
WEnd
$RS.close
$addfld.Close
$temp = StringSplit($data, "|")
GUICtrlSetData($sbrq, $data, $temp)
EndFunc ;==>rq
Func cx()
Global $sbbz
$Strn = GUICtrlRead($sbrq)
$addfld = ObjCreate("ADODB.Connection")
$RS = ObjCreate("ADODB.Recordset")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & $datename & ";Jet Oledb:Database Password=" & $datepass)
$RS.ActiveConnection = $addfld
$jy = "select sbbz from sbzb where sbyf= '" & $Strn & "'"
$RS.Open($jy)
If $RS.eof And $RS.bof Then
MsgBox(16, "提示", "没有找到申报记录", 5)
GUICtrlSetData($sbbz, "")
ControlFocus("", "", $sbbz)
Else
Switch $RS.Fields(0).value
Case 0
GUICtrlSetData($sbbz, "未申报")
Case 1
GUICtrlSetData($sbbz, "已申报")
Case Else
GUICtrlSetData($sbbz, "未知状态")
EndSwitch
EndIf
$RS.close
$addfld.Close
EndFunc ;==>cx
还有就是文字的颜色如何修改? GUICtrlSetColor(-1, 0x800000) GUICtrlSetColor(-1, 0x800000)
xlcwxl 发表于 2009-12-21 21:26 http://www.autoitx.com/images/common/back.gif
谢谢啊~但是多重查询如何写语句呢? select 字段1,字段2,字段3 from sbzb
$RS.Fields('字段1').value
$RS.Fields('字段2').value
$RS.Fields('字段3').value select 字段1,字段2,字段3 from sbzb
$RS.Fields('字段1').value
$RS.Fields('字段2').value
$RS.Fields ...
298311657 发表于 2009-12-24 01:45 http://www.autoitx.com/images/common/back.gif
谢谢啊~我试试! SELECT top 1 FROM tablea WHERE 胸围>36 and 腰<26 and 地区='中国' and (钱>99999999 or 她老爸钱>99999999)
页:
[1]