kehongpc 发表于 2014-2-25 20:44:27

大家帮帮忙 业主资料查询

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\xp\my documents\form1.kxf
$Form1_1 = GUICreate("业主资料查询", 219, 156, 273, 446)
$Input1 = GUICtrlCreateInput("", 16, 32, 121, 21)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
$Label1 = GUICtrlCreateLabel("请输入:", 16, 8, 52, 17)
$Button1 = GUICtrlCreateButton("搜索", 152, 32, 50, 25)
$Edit1 = GUICtrlCreateEdit("", 16, 72, 185, 45)
GUICtrlSetData(-1, "张小龙 钟小华 钟小明")
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###读取 C:\DOCUME~1\ADMINI~1\LOCALS~\Temp\myfile.ini

读取【字段名】等于输入的号码则在$Edit1文本框中显示A的值,也就是业主姓名

kehongpc 发表于 2014-2-25 20:45:29

我是新手,大家可以帮帮忙么?

kehongpc 发表于 2014-2-25 20:47:51

myfile.ini配置文件

a=徐小明


a=韩婆 韩海


a=梁凤


a=郭明 张芳


a=胡冰王


a=何明霞 胡宇宇


a=叶平平

xms77 发表于 2014-2-26 12:39:46

本帖最后由 xms77 于 2014-2-26 12:49 编辑

楼主你的ini文件好像应该这样写:

32191101=徐小明
32191102=韩婆 韩海
32191103=梁凤

代码如下:
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=c:\documents and settings\xp\my documents\form1.kxf
$Form1_1 = GUICreate("业主资料查询", 250, 180, 273, 446)
$Input1 = GUICtrlCreateInput("", 16, 32, 121, 21)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
$Label1 = GUICtrlCreateLabel("请输入:", 16, 8, 52, 17)
$Button1 = GUICtrlCreateButton("搜索", 152, 32, 50, 25)
$Edit1 = GUICtrlCreateEdit("", 16, 72, 200, 60)
GUICtrlSetData(-1, "张小龙 钟小华 钟小明")
GUISetState(@SW_SHOW)
Local $Name

While 1
        $msg = GUIGetMsg()
        Select
                Case $msg = $GUI_EVENT_CLOSE
                        Exit
                Case $msg = $Button1
                        $Name = IniRead(@ScriptDir & '\myfile.ini','a',GUICtrlRead($Input1),"未搜到")                       
                        GUICtrlSetData($Edit1, @CRLF & $Name,1)
    EndSelect       
        Sleep(100)
WEnd

xms77 发表于 2014-2-26 12:56:10

回复 1# kehongpc
这种查询最好用数据库来解决

lpxx 发表于 2014-2-26 13:35:10

myfile.ini配置文件

a=徐小明


a=韩婆 韩海


a=梁凤

[321911 ...
kehongpc 发表于 2014-2-25 20:47 http://www.autoitx.com/images/common/back.gif

你这种写法是你们体育老师教的?

haopp1 发表于 2014-2-26 15:55:39

有数据库么?

kehongpc 发表于 2014-2-26 21:15:21

回复 5# xms77
可是我不懂{:face (52):}

kehongpc 发表于 2014-2-26 21:16:03

回复 7# haopp1
没有,只是想利用读取INI文件来实现{:face (229):}

kehongpc 发表于 2014-2-26 21:35:53

回复 4# xms77
谢谢大哥的指点,写得真的很好,只是查询起来有点慢,不知道有没有什么办法能读取得快一点呢?

wilask 发表于 2014-2-27 09:56:44

用数据库吧

auto 发表于 2014-2-27 13:17:56

用SQLITE\MDB数据库或EXCLE文件吧
或者比较流行XML

haopp1 发表于 2014-2-27 14:37:17

回复 9# kehongpc


    那要写多长的INI啊 数据少的时候还可以 但是多了的话 AU3会死掉的建议使用个数据库
页: [1]
查看完整版本: 大家帮帮忙 业主资料查询