#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Dim $file = @ScriptDir & '\mdb.ini'
GUICreate('条件查询', 347, 312)
GUICtrlCreateLabel('查询条件:', 40, 64, 64, 17)
$Combo1 = GUICtrlCreateCombo('', 128, 64, 145, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, '会员编号|证件号码|会员卡号', '会员编号')
GUICtrlCreateLabel('查询内容:', 40, 128, 64, 17)
$Input1 = GUICtrlCreateInput('', 128, 120, 145, 21)
$Button1 = GUICtrlCreateButton('查询', 128, 168, 147, 25)
$Label = GUICtrlCreateLabel('查询结果显示', 32, 224, 307, 17)
GUISetState()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_dir()
EndSwitch
WEnd
Func _dir()
Local $dirlr = GUICtrlRead($Input1)
If $dirlr = '' Then Return MsgBox(16, '错误提示', '请输入查询内容', 2)
Local $cxtj = GUICtrlRead($Combo1)
Switch $cxtj
Case '会员编号'
Local $fjdate = IniRead($file, '会员档案', $dirlr, '')
If $fjdate <> '' Then
MsgBox(64, '查询提示', $fjdate)
Else
MsgBox(48, '查询提示', '数据库中未找到相关数据')
EndIf
Case '证件号码'
cx($dirlr, $cxtj, 3)
Case '会员卡号'
cx($dirlr, $cxtj, 6)
EndSwitch
EndFunc ;==>_dir
Func cx($dirlr, $cx, $xh)
Local $var = IniReadSection($file, '会员档案'), $x, $i
If @error Then Return MsgBox(16, '错误提示', '字段读取错误', 2)
For $i = 1 To $var[0][0]
Local $db = StringSplit($var[$i][1], '|')
If $db[$xh] = $dirlr Then
$x = 1
MsgBox(64, '提示', '存在' & $var[$i][0])
ExitLoop
EndIf
Next
If $x = 0 Then MsgBox(48, '提示', '不存在')
EndFunc ;==>cx