【发布时间】:2013-12-08 14:26:01
【问题描述】:
我的系统使用 SQL Server 2012,并使用实体框架,代码优先访问数据库,我的数据库是本地的,但我无法在 ConnectString 中使用 SERVER=localhost; 进行连接
我的App.config(工作中)
<connectionStrings>
<add name="SystemContext" connectionString="Server=JOHN-PC\SQLEXPRESS;Database=PizzariaDB;user=sa;password=12345" providerName="System.Data.SqlClient"/>
</connectionStrings>
但是,如果我将我的系统安装在另一台计算机、其他数据库中,PC 名称不是 JOHN-PC,所以我需要将其更改为通用 ConnectString
但是当我将JOHN-PC\SQLEXPRESS 更改为localhost 时,它不起作用
我可以做些什么来解决这个问题?
【问题讨论】:
-
对方机器没有sql实例吗?
标签: c# sql-server entity-framework localhost connection-string