本帖最后由 小凯 于 2010-5-21 17:49 编辑
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$mdb_data_path="good.mdb"
$mdb_data_pwd="1121"
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("输入数据", 153, 159, 351, 179)
$name = GUICtrlCreateInput("名字", 8, 16, 121, 21)
$tel = GUICtrlCreateInput("电话", 8, 40, 121, 21)
$qq = GUICtrlCreateInput("QQ", 8, 64, 121, 21)
$e_mail = GUICtrlCreateInput("e_mail", 8, 88, 121, 21)
$Button1 = GUICtrlCreateButton("写入", 80, 112, 49, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
sx()
EndSwitch
WEnd
Func sx()
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & $mdb_data_path & ";Jet Oledb:Database telword=" & $mdb_data_pwd)
$x=0
While 1
$x+=1
if $x >1 Then ExitLoop
$addfld.Execute("insert into tywb (name,tel,qq,e_mail) values('"&$name&"','"&$tel&"','"&$qq&"','"&$e_mail&"')")
WEnd
; $conn.Execute("insert into tywb (name,tel,qq,e_mail) values('"&$name&"','"&$tel&"','"&$qq&"','"&$e_mail&"')")
; $RS.close
$addfld.close
MsgBox(4096, "提示:"," 成功写入!")
EndFunc
[ 本帖最后由 小凯 于 2009-2-16 10:27 编辑 ] |