0

I've already seen some similar question but none of them has received a valid solution.

I've an asp.net web site which reference a dll with some method in order to execute a simple operation on database (CRUD operations). When I need to do some "select * from" I call a method of dll passing it the connection string, but any operation fails with error message like this: System.Data.SqlClient.SqlException: Login failed for user 'DOMAIN\MACHINENAME$'.

It's imposibile whereas my connection is right (user id=sa; password=password) and it is the same connection stirng that I use for all my web site. Idon't use integrated security=true, I'm just using sa account with password.

THE ONLY different between all my web site and this project is just that CRUD operation come from different assembly (my dll).

The code is very simple:

// Asp.Net Button Click
MyDll.MyClass DbClass = new MyDll.MyClass();
DbClass.ConnectionString = "Data Source=Source;Integrated Security=false;initial Catalog=NorthWind;user id=sa;password=password;Persist Security Info=true";
DbClass.ExecuteQuery(select * from tableName);
// ExecuteQuery method do other stuff as SqlDataAdapter sda = new....sda.Fill(myDataset)..

..Any ideas?

4

1 回答 1

2

The error message states that you are trying to use Integrated Security and is using your domain account to make a connection with sql server

But your connection string is correct and it might be possible that the dll have its connectionstring that overwrites your given connectionstring

于 2012-07-17T23:43:58.310 回答