A network-related or instance-specific error occurred while establishing a connection to SQL Server 2008

Answered A network-related or instance-specific error occurred while establishing a connection to SQL Server 2008

  • Monday, May 18, 2009 10:06 PM
     
     

    I tried this code in visual studio 2008 and i have SQL server 2008 installed on my laptop (my laptop name is MOMO-LAP and my user is MOMO) ,here is the code:

     

    Dim objConnection As SqlConnection = New SqlConnection("server=localhost\MOMO-LAP;database=pubs;user id=MOMO;password=")

     

    Dim objDataAdapter As SqlDataAdapter = New SqlDataAdapter()

     

    Dim objDataset As DataSet = New DataSet()
    but when i tried to execute it I receive this error :

    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)
    please i need help

All Replies