#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
$guione1 = GUICreate("QQ资料",880,725)
GUISetOnEvent($GUI_EVENT_CLOSE, "hou")
$ListView1 = GUICtrlCreateListView("QQ号|密码|密保问题一|密保问题二|密保问题三|密保绑定|申请时间|申请地点|来源|备注", 5, 5, 870, 660)
GUICtrlSendMsg(-1, 0x101E, 0, 80)
GUICtrlSendMsg(-1, 0x101E, 1, 90)
GUICtrlSendMsg(-1, 0x101E, 2, 100)
GUICtrlSendMsg(-1, 0x101E, 3, 100)
GUICtrlSendMsg(-1, 0x101E, 4, 100)
GUICtrlSendMsg(-1, 0x101E, 5, 80)
GUICtrlSendMsg(-1, 0x101E, 6, 80)
GUICtrlSendMsg(-1, 0x101E, 7, 80)
GUICtrlSendMsg(-1, 0x101E, 8, 80)
GUICtrlSendMsg(-1, 0x101E, 9, 80)
$Inputone1 = GUICtrlCreateInput("", 5, 665, 75, 25)
$Inputone2 = GUICtrlCreateInput("", 80, 665 ,90, 25)
$Inputone3 = GUICtrlCreateInput("", 170, 665 ,100, 25)
$Inputone4 = GUICtrlCreateInput("", 270, 665 ,100, 25)
$Inputone5 = GUICtrlCreateInput("", 370, 665 ,100, 25)
$Inputone6 = GUICtrlCreateInput("", 470, 665 ,80, 25)
$Inputone7 = GUICtrlCreateInput("", 550, 665 ,80, 25)
$Inputone8 = GUICtrlCreateInput("", 630, 665 ,80, 25)
$Inputone9 = GUICtrlCreateInput("", 710, 665 ,80, 25)
$Inputone10 = GUICtrlCreateInput("",790, 665 ,80, 25)
$Buonez1 = GUICtrlCreateButton("添加",5,695,130,25)
GUISetState(@SW_SHOW)
$adSourceone1 = @ScriptDir & "\DB1.mdb"
$adTableone1 = "test"
$adColone1 ="*"
$rDataone1 ="mydb"
If FileExists($adSourceone1) Then du()
If Not FileExists($adSourceone1) Then new()
While 1
Sleep(50)
WEnd
Func hou()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
Exit
Case $Buonez1
xie()
EndSwitch
EndFunc
Func new()
$newMdb = ObjCreate('ADOX.Catalog')
$newMdb.Create("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $adSourceone1 & ";Jet Oledb:Database Password=" & $adTableone1)
$newmdb.ActiveConnection.Close;建数据库
$addtbl = ObjCreate("ADODB.Connection")
$addTbl.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $adSourceone1 & ";Jet Oledb:Database Password=" & $adTableone1)
$addTbl.Execute("CREATE TABLE " & $rDataone1)
$addtbl.Close;建表
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $adSourceone1 & ";Jet Oledb:Database Password=" & $adTableone1)
$addfld.Execute("ALTER TABLE " & $rDataone1 & " ADD id identity(1, 1) primary key,qq text(255) ,mm text(255),mb1 text(255),mb2 text(255),mb3 text(255),mbbd text(255),sqt text(255),sqd text(255),ly text(255),bz text(255)");id identity(1, 1) primary key为自动编号和主键
$addfld.Close;建列表名
MsgBox(0,'提示:','创建成功!!!')
EndFunc
Func xie()
$readone1=GUICtrlRead($Inputone1)
$readone2=GUICtrlRead($Inputone2)
$readone3=GUICtrlRead($Inputone3)
$readone4=GUICtrlRead($Inputone4)
$readone5=GUICtrlRead($Inputone5)
$readone6=GUICtrlRead($Inputone6)
$readone7=GUICtrlRead($Inputone7)
$readone8=GUICtrlRead($Inputone8)
$readone9=GUICtrlRead($Inputone9)
$readone10=GUICtrlRead($Inputone10)
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &$adSourceone1 & ";Jet Oledb:Database Password=" & $adTableone1)
$addfld.execute("insert into "&$rDataone1&" (qq,mm,mb1,mb2,mb3,mbbd,sqt,sqd,ly,bz) values('"&$readone1&"','"&$readone2&"','"&$readone3&"','"&$readone4&"','"&$readone5&"','"&$readone6&"','"&$readone7&"','"&$readone8&"','"&$readone9&"','"&$readone10&"')")
$addfld.close
du()
EndFunc
Func du()
GUICtrlSendMsg($ListView1, $LVM_DELETEALLITEMS, 0, 0)
$addfld = ObjCreate("ADODB.Connection")
$addfld.Open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" &$adSourceone1& ";Jet Oledb:Database Password=" & $adTableone1)
$RS =ObjCreate("ADODB.Recordset")
$RS.ActiveConnection = $addfld
$RS.Open ("Select "&$adColone1 & " From " & $rDataone1 )
while Not $RS.eof And Not $RS.bof
if @error =1 Then ExitLoop
GUICtrlCreateListViewItem ( $RS.Fields (0).value&"|"&$RS.Fields (1).value&"|"& $RS.Fields (2).value&"|"& $RS.Fields (3).value&"|"& $RS.Fields (4).value&"|"& $RS.Fields (5).value&"|"& $RS.Fields (6).value&"|"& $RS.Fields (7).value&"|"& $RS.Fields (8).value&"|"& $RS.Fields (9).value,$ListView1 )
$rs.movenext
WEnd
$rs.close
$addfld.Close
EndFunc