Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
When i add .mdf file in visual studio 2010 it show following 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: Shared Memory Provider, error: 40 - Could not open a connection to SQL Server "

Can someone help me to solve this plz!!!!!
Posted
Comments
surya 2013 1-Jun-13 0:53am    
When i go ---services---->Sql server(SQL EXPRESS)-->start the service--it shows following error=====>>window could not start the sql server(SQL EXPRESS) service on local computer and ==>error 1068 the dependency service or group failed to start
plz some susggestion

These type of issue is came for network error to unable to connect the mdf into ur project

First step u check the database is exist
Second ur lan connectivity is ok.
third step connect ur database for test connection is successed
right click ur project add -> Existing Item -> choose allFiles in selection dropdown - > select ur mdf file -> DataSource Configuration Wizard -> Entity Data Model ->
Generate from Database -> Next -> Automatically added in ur project and web.config

or otherwise the sqlserver to restart in services.msc
 
Share this answer
 
Comments
surya 2013 30-May-13 4:47am    
how to find this ----DataSource Configuration Wizard -> Entity Data Model ->
Generate from Database -> Next -> Automatically added in ur project and web.config
Check the SQL server service for that instance in SQL server configuration manager. I think it is probably stopped. The SQL Server name you specified is correct but the SQL server service that is trying to connect is not working so in your command prompt type; "services.msc" and run it. Find SQL Server and start it.

Good luck,
OI
 
Share this answer
 
v2
Comments
surya 2013 30-May-13 2:49am    
I am already add .dbo file and it work fine but .mdf file not add
Orcun Iyigun 30-May-13 3:01am    
Check this link: Resolving could not open a connection to sql server errors[^].This gives you all possible steps to take.
surya 2013 30-May-13 3:12am    
Already started sqlserver(MSSQLSERVER)
but sqlserver(SQLEXPRESS) is stopped,can i start this or not give suggestion plz.
Orcun Iyigun 30-May-13 3:30am    
Already started sqlserver(MSSQLSERVER) but sqlserver(SQLEXPRESS) is stopped, are you saying that you tried starting the server but it failed to start? Can you say it in a different way because i don't understand what you are trying to say.
surya 2013 30-May-13 7:42am    
yes,it failed to start

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900