找回密码
 加入
搜索
查看: 2666|回复: 7

如何在ACESS中做多重查询?

  [复制链接]
发表于 2009-12-21 08:25:02 | 显示全部楼层 |阅读模式
本帖最后由 pizigao 于 2009-12-21 08:28 编辑


我现在只做到一个查询方式~其他项目不知道如何插入~请大家帮忙!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?加入

×
 楼主| 发表于 2009-12-21 08:28:01 | 显示全部楼层
#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[1])

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
 楼主| 发表于 2009-12-21 08:34:53 | 显示全部楼层
还有就是文字的颜色如何修改?
发表于 2009-12-21 21:26:08 | 显示全部楼层
GUICtrlSetColor(-1, 0x800000)

评分

参与人数 1金钱 +10 收起 理由
afan + 10

查看全部评分

 楼主| 发表于 2009-12-24 00:56:57 | 显示全部楼层
GUICtrlSetColor(-1, 0x800000)
xlcwxl 发表于 2009-12-21 21:26



谢谢啊~但是多重查询如何写语句呢?
发表于 2009-12-24 01:45:30 | 显示全部楼层
select 字段1,字段2,字段3 from sbzb
$RS.Fields('字段1').value
$RS.Fields('字段2').value
$RS.Fields('字段3').value

评分

参与人数 1金钱 +15 收起 理由
afan + 15

查看全部评分

 楼主| 发表于 2009-12-25 22:16:24 | 显示全部楼层
select 字段1,字段2,字段3 from sbzb
$RS.Fields('字段1').value
$RS.Fields('字段2').value
$RS.Fields ...
298311657 发表于 2009-12-24 01:45



谢谢啊~我试试!
发表于 2009-12-27 18:05:27 | 显示全部楼层
SELECT top 1 FROM tablea WHERE 胸围>36 and 腰<26 and 地区='中国' and (钱>99999999 or 她老爸钱>99999999)
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-22 15:26 , Processed in 0.081957 second(s), 25 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表