title: Problems connecting to remote SQL Server using AutoIT
body: <p>I am attempting to create a login mechanism by which you can access a remote SQL Server 2008 R2 database, in a private network, if the credentials are correct. I intend to implement the database at my work server and this program at a client which is in the same subnet as the server. Here is my code so far:</p>
  
  <pre><code>Func Login()
  
     $loginGUI = GUICreate("Login", 250, 150, -1, -1) ; will create a dialog box that when displayed is centered
     GUISetState(@SW_SHOW)
     GUICtrlCreateLabel ( "Input valid credentials to login", 40, 10,-1,-1) 
     GUICtrlCreateLabel ( "Username", 40, 40,-1,-1)
     Local $userInput = GUICtrlCreateInput("", 100, 37, 100, 20)
     GUICtrlSetState($userInput, $GUI_FOCUS)
     GUICtrlCreateLabel ( "Password", 40, 70,-1,-1)
     Local $passwordInput = GUICtrlCreateInput("", 100, 67, 100, 20, $ES_PASSWORD)
     Local $loginButton = GUICtrlCreateButton("Login", 40, 105, 70)
     Local $exitButton = GUICtrlCreateButton("Exit", 130, 105, 70)
  
     GUISetState()
     ; Run the GUI until the dialog is closed
     While 1
        $msg = GUIGetMsg(1)
        Switch $msg[0]
           Case $loginButton
              $user = GUICtrlRead($userInput)
              $password = GUICtrlRead($passwordInput)
              Global $loginCon = ObjCreate( "ADODB.Connection" )
              With $loginCon
                 .ConnectionString =("DRIVER={SQL Server};SERVER=192.168.1.30\SQLEXPRESS;DATABASE=Test;UID="&amp;$user&amp;";PWD="&amp;$password&amp;";")
                 .Open
              EndWith
              If ($user ="" and $password="") or @error Then
                 MsgBox(48, "Login error", "Connection failed! Wrong Username/Password.")
                 GUICtrlSetData($userInput, "")
                 GUICtrlSetData($passwordInput, "")
                 GUICtrlSetState($userInput, $GUI_FOCUS)
              Else
                 $loginCon.Close
                 GUIDelete()
                 Main()
                 ExitLoop
              EndIf
           Case $exitButton
              GUIDelete()
              ExitLoop
           Case $GUI_EVENT_CLOSE
              GUIDelete()
              ExitLoop
        EndSwitch
     WEnd
  
  EndFunc
  </code></pre>
  
  <p>I've also did the following actions:</p>
  
  <ol>
  <li>Used SQL Server Management Studio to allow remote connections as well as the proper permissions for the correct user to access the database.</li>
  <li>Used SQL Server Configuration Manager to enable SQL Server Browser and the TCP/IP protocol with the proper configurations to access the server.</li>
  <li>Created a firewall Inbound and Outbound rule which allows access to TCP port 1433 and UDP port 1434 for the server and client (just in case).</li>
  <li>Added <code>sqlservr.exe</code> and <code>sqlbrowser.exe</code> to the firewall allowed programs list.</li>
  <li>Installed SQL Server Native Client 2008 R2 on the client PC.</li>
  </ol>
  
  <p>I could connect locally to my database using the server IP but I get the following error when attempting to connect from the remote client to the server:</p>
  
  <blockquote>
    <p><em>err.description is: [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.</em></p>
  </blockquote>
  
  <p>Strangely enough, I could connect from the remote client using <code>sqlcmd</code>. I also have to mention that I am currently using my laptop to hold my test database. It's IP is assigned by the DCHP server from work and always remains the same.</p>
  
  <p>Is my code incorrect or do I have to make additional server/client configurations?</p>