【发布时间】:2015-02-19 09:17:14
【问题描述】:
我安装了 SQL Server 和 Visual Studio,并尝试做我的大学项目。
我可以在 Management Studio 中连接到 SQL Server,但在 Visual Studio 中无法连接!
- 已启用远程连接
- 所有服务都在运行
- 一切正常,但我不知道为什么会出现此错误:
与 SQL Server 建立连接时发生网络相关或特定于实例的错误。未找到服务器或无法访问服务器。请验证实例名称是否正确以及...
这段代码有什么问题?
SqlConnection sqcon = new SqlConnection("Data Source=.;Initial Catalog=Badan_Sazi;Integrated Security=True");
SqlCommand com = new SqlCommand();
com.Connection = sqcon;
com.CommandText = "SELECT tbl_morabi.family as 'lname' FROM tbl_morabi";
com.Connection.Open();
我也尝试过.、localhost、my pc name ... 还是同样的错误
- 视觉音频 2012
- SQL Server Express 2012
【问题讨论】:
标签: c# sql-server visual-studio-2012 sql-server-2012 database-connection