A network-related or instance-specific error occurred while establishing a connection

Discussion in 'C#' started by suri123, Dec 18, 2008.

  1. suri123

    suri123 New Member

    Joined:
    Dec 17, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    0
    Hi All,
    I am new to ADO.NET using C#.I have made a connection string which consists only the connection string. I am using SQLExpress 2008. connection is not opened.
    I got an error showing "A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)"
    Below is the code:
    SqlConnection cn=new SqlConnection("Data Source=\"C:\\Documents and Settings\\12345\\My Documents\\Visual Studio 2008\\Projects\\CustomerDataBase\\CustomerDataBase\\CustomerInfo.sdf\"");
    cn.Open();
    Any help would be appreciated..

    Thanks in advance.,
    Suresh kumar palleti.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice