1

我正在尝试使用 C# 在 Sql Server 2008 中遵循 CLR 集成的简单示例: http ://www.sqlservercentral.com/articles/SQL+Server+2008/87743/

但是当我尝试部署项目时,它会抛出一个错误:

开始将程序集 SimpleCLRIntegrationNew.dll 部署到服务器 xxxxxxxxx\SQLExpress:TableName C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\TeamData\Microsoft.Data.Schema.SqlClr.targets(96,5):错误:无法连接到服务器 xxxxxxxxxx\SQLExpress BlogData:用户“sa”登录失败。

但是连接正确且有效

4

1 回答 1

0

I don't really understand the technical background here, but I noticed the following problem:

When in VisualStudio, check the Project Properties, and under the Database Tab you have the Connection string.

It looks something like this:

Data Source=[ServerName];Initial Catalog=[DBName];Integrated Security=True

I unfortunately didn't copy the connection string from before - but instead of Integrated Security=True it had something with ...User.... I think I had UserID=sa specified, but don't remember exactly, and I don't know why the connection string was set that way.

I clicked the Browse-button and refreshed the connection (chose my DB and clicked 'OK'). The connection string for the project was reset with the Integrated Security=True optionset.

I don't know if it matters, but in my CLR I'm connecting to the db using "context connection=true"

于 2014-02-13T17:28:06.627 回答