5
votes

I'm using service-based database, so db file is stored with the program. It makes it easier for the end-user, when they can easily move the app with the db to another computer.

Here is my connection string for it:

add name="DBEnitity"
connectionString="metadata=res:///Model.csdl|res:///Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string="data source=SQLEXPRESS2008;attachdbfilename=|DataDirectory|\db.mdf;integrated security=True;user instance=True;multipleactiveresultsets=True;App=EntityFramework"" providerName="System.Data.EntityClient" />

But it won't connect if I test it on machine with a SQL Server Express 2012 installed. Why is that? Thanks!

2
does source=SQLEXPRESS2008 matter?DJ Burb

2 Answers

0
votes

You should use data source=. to connect to a default instance of sql server, or data source=.\SQLSERVERNAME for sql server named instance

0
votes

You should use:

data source=.

where . means local SQL server.