Question

  • Creator
    Topic
  • #2260043

    Sql Server, C#

    Locked

    by karatj ·

    i’ve created an SQL Express Database within my C# program When i try to run the program i get an error message that says:

    “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)”

    pls if any ideas it would be greatly appreciated

All Answers

  • Author
    Replies
    • #2523816

      Clarifications

      by karatj ·

      In reply to Sql Server, C#

      Clarifications

    • #2523579

      Could be several things that

      by tony hopkinson ·

      In reply to Sql Server, C#

      Can you connect to it from the management studio?
      Another tool you get is the Surface Area Configuartion tool. Among other things it sets whether the server can receive connections and what protocols can be used.

      For issuing a Craete Database command on my instance of express , I would have expected the connection string to be
      “server=localhost”; database=master; security = “SSPI”
      or close anyway.

    • #2595244

      When connecting from web application…

      by drpesic ·

      In reply to Sql Server, C#

      Recently we had same issue, and it was happening only when u try to connect through an AP.NET web service, without an windows user credentials. Problems was not in the settings on the server or the firewall or anything like that. In the end, it appeared that owner of the call (ASPNET user in this case) did not have the proper security rights to verify location of the sql server with the name mentioned in the connection string. Once we used direct IP instead, it worked just fine.

Viewing 2 reply threads