sunafter 发表于 2014-9-12 19:39:08

AU3怎么连接sql 2012数据库?[已解决]

本帖最后由 sunafter 于 2014-9-26 22:04 编辑

求大神给个示例

winple 发表于 2014-9-13 16:29:18


#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仅供参考,哈哈

sunafter 发表于 2014-9-26 22:04:21

回复 2# winple
感谢楼上的兄弟
页: [1]
查看完整版本: AU3怎么连接sql 2012数据库?[已解决]