Database problems with SQL 2008 R2

Jul 4, 2010 at 2:47 PM

I am using the version that goes with Visual Studio 2010, I am using Windows 7 Ultimate and SQL 2008 R2.  I am receiving a bunch of exceptions and an error, is there any documentation on creating the database?

Here is the error I am getting:

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)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: 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)

Source Error:

Line 26:             // the albums with the highest count
Line 27:
Line 28: return storeDB.Albums
Line 29: .OrderByDescending(a => a.OrderDetails.Count())
Line 30: .Take(count)


Source File: C:\inetpub\wwwroot\mvcmusicstore-9299484ae233\mvcmusicstore_9299484ae233\MvcMusicStore\Controllers\HomeController.cs    Line: 28

Thank you

LadyDee

Coordinator
Jul 9, 2010 at 5:25 PM

Are you following along in the tutorial, or are you looking at the application code that was downloaded? If you're following the tutorial, the information on how to add the database is shown on page 33. If you're using downloaded code, you can check to see if it's connected by expanding the App_Data folder, double-clicking on MvcMusicStore.mdf to bring up the Server Explorer, and expanding the Tables folder. Can you try that and let me know what happens?

Jul 9, 2010 at 5:50 PM

I will try all your suggestions and let you know how it goes.

Thank you

LadyDee

 

Nov 3, 2010 at 2:43 PM

Hi, i am using VS 2010 + SQL Express 2008,i downloaded the code from MVCmusicstore site, i can connect to the database and load all the album, but when i log on with "userName" and  "password123", i had the same problem as Ladydee:

 

      public bool ValidateUser(string userName, string password)
        {
            ValidationUtil.ValidateRequiredStringValue(userName, "userName");
            ValidationUtil.ValidateRequiredStringValue(password, "password");

            return _provider.ValidateUser(userName, password);
        }

and

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)

- Server name is correct. (connection string and  data connection in VS 2010).  But my SQL Server Browser can not start. Is that the problem?

Any suggestion would be thankful !

Regard

Lucas

 

 

-

 

Coordinator
Nov 4, 2010 at 7:53 PM

Can you check your connection strings in your web.config and verify that they look similar to the following?

  <connectionStrings>
    <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" />
    <add name="MusicStoreEntities" connectionString="metadata=res://*/Models.StoreDB.csdl|res://*/Models.StoreDB.ssdl|res://*/Models.StoreDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MvcMusicStore.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

Nov 5, 2010 at 8:07 PM

Thank jon !

 Mine is exact like that except My SQL Name is SQLEXPRESS2008 . And i already change the data connection Instance name to SQLEXPRESS2008

and i can load all the albums but still cannot log on as admin with the same error.

 

I think the code is correct but i still got some problem about SQL express 2008, and ASP configuration : 

- ASP configuration : i cannot open tab Security, it showed the same 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)

- Although i did install and uninstall SQL express 2008 many time but my SQL server browser cannot work. Am i missing something ?

My major is java, this is the first time i touch .Net. So sorry about these foolish questions ! Hoping you can help me out of this .

Regard .

 

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)