源码如下
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$datename= @ScriptDir & "\data.mdb"
$datepass="GSDKDJV1200Jdls2008"
#Region ### START Koda GUI section ### Form=20090908.kxf
$Form1_1 = GUICreate("申报标志修改工具 FOR1.2", 291, 160, 343, 258)
$Label1 = GUICtrlCreateLabel("申报日期:", 21, 18, 64, 17)
$Label3 = GUICtrlCreateLabel("日期格式:YYYYMM;如:200908", 21, 124, 241, 17)
$Label5 = GUICtrlCreateLabel("状态说明:0 未申报;1 已申报 ", 21, 140, 241, 17)
$sbrq=GUICtrlCreateInput("200908", 97, 15, 105, 21,$ES_NUMBER)
GUICtrlSetLimit(-1, 6)
$Button1 = GUICtrlCreateButton("查询", 225, 13, 43, 25, 0)
$Button2 = GUICtrlCreateButton("修改", 225, 95, 43, 25, 0)
$xgzt=GUICtrlCreateInput("", 97, 97, 105, 21,$ES_NUMBER)
GUICtrlSetLimit(-1, 1)
$Label4 = GUICtrlCreateLabel("修改状态:", 21, 100, 64, 17)
$sbzt=GUICtrlCreateInput("", 97, 56, 105, 21,$ES_NUMBER)
GUICtrlSetLimit(-1, 10)
GUICtrlSetState(-1, $GUI_DISABLE)
$Label2 = GUICtrlCreateLabel("申报状态:", 21, 59, 64, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $Button1
cx()
case $Button2
xg()
EndSwitch
WEnd
Func cx()
Global $sbzt
$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 ( $sbzt,"")
ControlFocus ( "", "", $sbzt)
Else
GUICtrlSetData ( $sbzt,$RS.Fields (0).value)
EndIf
$rs.close
$addfld.Close
EndFunc
Func xg()
$Strn=GUICtrlRead($sbrq)
$srbz=GUICtrlRead($xgzt)
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & $datename & ";Jet Oledb:Database Password=" & $datepass)
$sQuery ="update sbzb set sbbz=" &$srbz & " where sbyf= '" & $Strn & "'"
MsgBox(64, "提示","状态更新成功!")
$addfld.execute($sQuery)
$addfld.close
EndFunc
|