2

we decided to start a new project using the Microsoft SQL Server R2 under Win7. I installed SQLEpress R2 on my system and it was decieded to called it BEACONExpress. At first we could not get it to run, until we had our Domain SysApp come in and set the ownership to my login. Now I was able to use SQL Management Studio to create the Database. I even added some Tables to it. Then I fired up VS 2010 and created a test program. When I try and access the new database, VS returns this error "The file can not be opened because it is being used by another process. Please close all applications that might access this file and try again."

If I attempt to create a new database under App_Data it returns this error. A network-related or instance-specific error occurered 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).

The connectionStrings in Web.config says

<connectionStrings>
  <add name="ApplicationServices"
       connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename= |DataDirectory|aspnetdb.mdf;User Instance=true"
       provideName=:System.Data.SqlClient" />
</connectStrings>

I found the database at C:\Program Files\Microsoft SQL Server\MSSQL10_50.BEACONEXPRESS\MSSQL\DATA\BeaconDB.mdf

I tried changing SQLEXPRESS to MSSQL10_50.BEACONEXPRESS but it had no affect. I have been reading here and on other forums trying to determine what is wrong but so far have not found an answer.

Cœur
  • 37,241
  • 25
  • 195
  • 267
  • It should be `data source=`, not `data source-`. – Jesse C. Slicer Sep 24 '12 at 14:03
  • What I have found is I can go into Server Explorer and access the Database but it comes back as a .dbo file. How to I get App_Data to access a .dbo file? –  Sep 24 '12 at 17:48

2 Answers2

0

Change your connection string element to

connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;Initial Catalog=BeaconDB" 

(Where BeaconDB is the name of your database)

podiluska
  • 50,950
  • 7
  • 98
  • 104
  • Try BEACONEXPRESS instead of SQLExpress – podiluska Sep 24 '12 at 14:20
  • What I have found is I can go into Server Explorer and access the Database but it comes back as a .dbo file. How to I get App_Data to access a .dbo file? –  Sep 24 '12 at 17:48
0

Have you verified that the Windows 7 firewall is configured to let you access the SQL Server? I had the same problem when triyng to access a database on my server at home, with Win7 x64.

Also, you should be sure to run the version SQL Server 2008 R2, because if R2 is not installed and all the updates are not installed, it will not work on Win7 x64

Maybe this link can help you: http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/1bb10896-27ed-4469-81e0-a84f4fba68c9

http://blogs.msdn.com/b/sqlexpress/archive/2005/05/05/415084.aspx

Danielle Paquette-Harvey
  • 1,691
  • 1
  • 16
  • 31
  • This is a company system, so have no access to firewall. Guess I need to have the domain sysapp logon and take a look. What do I need to set in the firewall? –  Sep 24 '12 at 15:18
  • A lot of details are in the two links I posted in my original reply. + There is a possibility that Windows Firewall is enabled on every PC and that the company has its own firewall. (At my job, it's like that) so you can have problems with either of the firewall. You should check just to make sure. – Danielle Paquette-Harvey Sep 24 '12 at 15:23
  • I can access the database using the Manager Studio and even create tables. –  Sep 24 '12 at 15:24
  • I suspect the local firewall sense SQL Server 2008 R3 Express and the database are on the same computer I am doing developtment on. –  Sep 24 '12 at 15:48
  • I found that I need to exclude ports 1433 and 1434. Any other ports I need to exclude in the filewall? –  Sep 24 '12 at 15:49
  • I found a scrip that when I ran it said it open the following TCP Port 1433, 1434, 4022, 135, 2382, 2383, 80 and UDP port 1434. I restarted my VS2010 program but I still get the same errors. –  Sep 24 '12 at 16:15
  • Have you checked that TCP/IP is enabled in SQL Server Configuration? – Danielle Paquette-Harvey Sep 24 '12 at 17:23
  • You can also try to "enable remote connection" to the server (right-click Properties on the server in Management Studio) under "Connections" – Danielle Paquette-Harvey Sep 24 '12 at 17:24
  • What I have found is I can go into Server Explorer and access the Database but it comes back as a .dbo file. How to I get App_Data to access a .dbo file? –  Sep 24 '12 at 17:54
  • Could it be that the user you are usign to connect to the database has insufficient rights? – Danielle Paquette-Harvey Sep 24 '12 at 19:48
  • 1
    I found a solution. I removed the App_Data section and installed the Entity Data Model. It linked to the .DBO database and now I am going great. Thanks for all the help. –  Sep 25 '12 at 11:12