3 Replies Latest reply on Feb 11, 2011 6:20 AM by Raghavendra Bhagavan.S.M

    Can't connect to SQL Server 2008 using it string...

    Sierra Moveis

      Hello

       

      In an EPDM Add-in I tried to connect to SQL Server 2008 using the following code:

       

      Private Sub ConectaSQLServer()
              'Define variaveis para conexao
              Dim server As String = "serverName"
              Dim userId As String = "userID"
              Dim password As String = "password"
              Dim dataBase As String = "table"

       

              Dim strConn As String = "Data Source=" + server + ";" + "Initial Catalog=" + dataBase + ";" + _
                                      "User ID=" + userId + ";" + "Password=" + password

       

              sqlConn = New SqlConnection(strConn)

       

              Try
                  sqlConn.Open()
              Catch ex As Exception
                  MsgBox(ex.ToString)

              End Try
      End Sub

       

      The program was compiled in a computer with Windows XP 32 bits

      It program works well in computers with XP 32 bits

      But I have one computer with Windows 7 64 bits where it code doesn't work

      I get an error message:

       

      System.Data.SqlClient.SqlException (0x80131904):

      A network-related or instance-specific error ocurred

      while establishing a connection to SQL Server.
      The server was not found or was not accessible.

       

      What I have to do to correct this?

       

      Thanks