For Entity Framework (database-first or model-first; when you have a physical EDMX model file) you need to use a special type of connection string which is quite different from the straight ADO.NET connection strings everyone else has mentioned so far...
The connection string must look something like:
<add name="testEntities"
connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string="data source=(local);initial catalog=test;integrated security=True;multipleactiveresultsets=True;App=EntityFramework""
providerName="System.Data.EntityClient" />
Inside this connection string, you'll find the provider connection string=
attribute which is basically your ADO.NET connection string:
provider connection string="data source=(local);initial catalog=test;integrated security=True;multipleactiveresultsets=True;App=EntityFramework""
So here, you need to change your server name and possibly other settings.
data source=....
stands for your server (you can also use server=.....
)
initial catalog=.....
stands for your database (you can also use database=....
)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…