locked
SqlConnection Server Error RRS feed

  • Question

  • User728361581 posted

    I am having a hard time finding information about this error online.  I was hoping someone could help me with it.  I am working with MS Visual Studio 2005.  The SQL Server version is 2000.  The error bellow says I am trying to connect to SQL 2005.  Also, I can use MSVS Server Explorer and SQL Server Enterprise Manager to connect to the database.
    Here is my code:

     
    
    imports System.data
    Dim Connect As New SqlClient.SqlConnection
    Dim Adapter As New SqlClient.SqlDataAdapter
    Dim St As New DataSet
    Dim ConnectString As String
    ConnectString = "Data Source=MANDB01;Initial Catalog=MANCON_WEB;Integrated Security=True"
    Connect.ConnectionString = ConnectString
    Adapter.SelectCommand = New SqlClient.SqlCommand("select * from item_cat1", Connect)
    Adapter.SelectCommand.Connection.Open()
    Adapter.Fill(St)
    Connect.Close()
     
     
    The browser is reporting this error: 

    An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

    Wednesday, December 6, 2006 9:19 AM

Answers

  • User728361581 posted

    I was able to change servers, and it connected just fine.  From what the IT manager tells me, the named pipes had $ in side part of the configuration for named pipes.  He is looking at whats different in the mean time.

    Thanks for everyone's help. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 7, 2006 12:55 PM

All replies

  • User300685930 posted

    I usually enable username/password login in sqlserver and add it to the connectstring.  it then looks like this:

    <connectionStrings>
        <add name="PulseFactors.Data.ConnectionString" connectionString="Data Source=localhost;Initial Catalog=PulseFactors;Persist Security Info=True;User ID=sa;Password=xxx"/>
      </connectionStrings>

    Wednesday, December 6, 2006 10:20 AM
  • User-902308856 posted

    Hi

    Make sure Named Pipes and TCP/IP network libraries are enabled for the SQL2000 instance.

    Wednesday, December 6, 2006 9:26 PM
  • User728361581 posted

    I was able to change servers, and it connected just fine.  From what the IT manager tells me, the named pipes had $ in side part of the configuration for named pipes.  He is looking at whats different in the mean time.

    Thanks for everyone's help. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, December 7, 2006 12:55 PM