#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <SQLite.au3>
#include <SQLite.dll.au3>
#Region ### START Koda GUI section ### Form=
Global $Form1 = GUICreate("铜矿花名册", 1024, 768)
$ListView1 = GUICtrlCreateListView("", 5, 50, 1010, 710)
$Button1 = GUICtrlCreateButton("录入", 24, 13, 124, 25)
$Button2 = GUICtrlCreateButton("修改", 240, 13, 124, 25)
$Button3 = GUICtrlCreateButton("删除", 456, 13, 124, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
If Not FileExists(@ScriptDir & '\db\name.db') Then createTable()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $Button1
GUISetState(@SW_DISABLE,$Form1)
insertName()
Case $Button2
MsgBox(0,'','')
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
Func createTable() ;建表
_SQLite_Startup()
_SQLite_Open(@ScriptDir & '\db\name.db')
_SQLite_Exec(-1, 'create table if not exists name(BianHao integer primary key,XinMing text Not Null,GongZhong text,DianHua int,ShenFengZhenHao int Not Null,SFZSaoMiao blob)')
;字段名全拼音,最后一个是存放身份证扫描件的,还有如果不在矿的话,工种那里直接写离矿,这个办法蛮好。。。
;还有 建表时加 if not exists 这样做的好处是不用知道表是不是存在,创建时,如果有表存在,就不会重复创建。
;sqlite要插入数据,才建表,这个很郁闷。。。刚测试了下。。
_SQLite_Exec(-1, "insert into name(XinMing,ShenFengZhenHao) values ('赵兴',622225198602101215);") ;这句只是为了建表,sqlite不插入数据不建表的.
;_SQLite_Exec(-1,"truncate table name") sqlite 不支持truncate table
_SQLite_Exec(-1, "delete from name") ;删除表内所有行
_SQLite_Close()
_SQLite_Shutdown()
EndFunc ;==>createTable
Func insertName()
$Form2 = GUICreate("信息录入", 344, 340,-1,-1,-1,-1,$Form1)
$Label1 = GUICtrlCreateLabel("姓 名", 16, 16, 52, 17)
$Input1 = GUICtrlCreateInput("Input1", 80, 16, 121, 21)
$Label2 = GUICtrlCreateLabel("身份证号", 16, 48, 52, 17)
$Input2 = GUICtrlCreateInput("Input2", 80, 48, 193, 21)
$Label3 = GUICtrlCreateLabel("职 务", 16, 80, 52, 17)
$Combo1 = GUICtrlCreateCombo("Combo1", 80, 80, 129, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
$Pic1 = GUICtrlCreatePic("", 8, 152, 212, 180)
$Label4 = GUICtrlCreateLabel("证件扫描", 16, 112, 52, 17)
$Input3 = GUICtrlCreateInput("Input3", 80, 112, 129, 21)
$Button1 = GUICtrlCreateButton("选择图片", 216, 112, 59, 25)
$Button2 = GUICtrlCreateButton("ok", 232, 168, 35, 161)
GUISetState(@SW_SHOW,$Form2)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUISetState(@SW_ENABLE,$Form1)
GUIDelete($Form2)
ExitLoop
EndSwitch
WEnd
EndFunc ;==>insertName
第一次点录入按钮时会出子窗口,第二次就不出了。。。。高手帮忙。。。