카테고리 없음

[SQL 서버] AutoIt에서 SQL 쿼리를 실행해야합니다.

행복을전해요 2020. 12. 13. 20:24

이제 끝났어 ...

$constrim="DRIVER={SQL Server};SERVER=sqlstaging;DATABASE=NivioAsia2;uid=niviodbstaging;pwd=niviodbstaging;"
$adCN = ObjCreate ("ADODB.Connection") ; <== Create SQL connection
$adCN.Open ($constrim) ; <== Connect with required credentials
MsgBox(0,"",$constrim )

if @error Then
    MsgBox(0, "ERROR", "Failed to connect to the database")
        Exit
        Else
            MsgBox(0, "Success!", "Connection to database successful!")
            EndIf
            
            $sQuery = "select * from irws_m_users where n_userid=10318583224314"
            
            $result = $adCN.Execute($sQuery)
            MsgBox(0, "", $result.Fields( "s_username" ).Value)
            $adCN.Close ; ==> Close the database
            


출처
https://stackoverflow.com/questions/7415093