#include <GUIConstantsEx.au3>
Dim $Server = '192.168.11.99' ;数据库ip地址
Dim $Suser = 'sa'
Dim $Sdate = 'master' ;数据库名称
Dim $Spassword = '654321' ;数据库密码
;
;数据库连接
;
$conn = ObjCreate("ADODB.Connection")
$RS = ObjCreate("ADODB.RecordSet")
$conn.Open ("driver={SQL Server};SERVER=" & $Server & ";DATABASE=" & $Sdate & ";UID=" & $Suser & ";PWD=" & $Spassword & "");
If @error Then
MsgBox(64, '警告!', '数据库连接错误!!!')
Else
MsgBox(64, '警告!', '数据库连接成功!!!')
Exit
EndIf
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
仅供参考,哈哈 |