我将一个网络应用程序以及我用来测试的数据库从我的个人计算机移至我的工作计算机。单击插入数据的提交按钮时,出现错误,找不到服务器/实例。我认为位于此处的域是问题的一部分。这是我的连接字符串,我已经尝试了几种形式。
Data Source=\\bkirkland_lpt.domain.com\brandon;Initial Catalog=STATUS;integrated security=SSPI;persist security info=False;Trusted_Connection=Yes;");
我在这里看到几个问题。
首先,您似乎使用了错误的数据源。数据源的格式应为 [服务器名称]\[实例名称]。根据您的代码,我建议
Data Source=bkirkland_lpt.domain.com\brandon;Initial Catalog=STATUS;integrated security=SSPI;persist security info=False;Trusted_Connection=Yes;
此外,我注意到您正在使用集成安全性。这意味着您正在运行的用户必须被授予对数据库的权限。我的猜测是您的域用户无权访问您移动的数据库。
kirkland_lpt.servicesource.com randon 是共享文件夹路径,而不是主机名。尝试 bkirkland_lpt.servicesource.com
尝试将服务器名称括在
[]
中。尝试用 localhost 替换服务器名称,看看是否有任何区别(如果都在本地计算机上)。我还会使用正确的大小写和 True 与 Yes 作为参数值。
Data Source=[bkirkland_lpt.domain.com]\brandon;Initial Catalog=STATUS;Integrated Security=SSPI;Persist Security Info=False;Trusted_Connection=True;
Data Source=localhost\brandon;Initial Catalog=STATUS;Integrated Security=SSPI;Persist Security Info=False;Trusted_Connection=True;