Discussion Locked

Connection String for SQL SERVER

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

System.Data.SqlClient.SqlException: Login failed for user 'Administrator'. Reason: Not associated with a trusted SQL Server connection.

I m getting this error while establish the connection at the back-end.

4 replies

by madestroitsolutions

This error occurs because by default SQL 2000 does not support SQL Server authentication and supports only Windows authentication. To overcome this limitation:

- Enter SQL Enterprise Manager.
- Find your server name in the tree on the left.
- Right mouse click on the server name and select properties.
- Click the Security folder. You should now see the screen below with "Windows Only" set as the default authentication.
- Check SQL Server and Windows as the Authentication.
- Click OK.
- Click Yes to restart SQL.

Good luck!

by ahar

If you want to use NT-Authorisation.
First you have to grant (databaseserver-)login for the specific User.
Then enter your database and grant access to the user.
Those two Stored procedures will do the job:

EXEC sp_grantlogin N'\Administrator';
GO
use
GO
EXEC sp_grantdbaccess N'\Administrator', 'name_in_db';
GO

by lukcad

It is connection string for you collegue:
server=(local)\YOURSERVER;Trusted_Connection=true;database=YOURDATABASE
I glad to hear ASP.NET pro.
Type instead of YOURSERVER and YOURDATABASE names of your sql server and your sql database.

If you know it and it is not help you, then try grant access to your database correctly:

osql -E -S (local)\YOURSERVER -d YOURDATABASE -Q "sp_grantdbaccess 'COMPUTERNAME\ASPNET'"
osql -E -S (local)\YOURSERVER -d YOURDATABASE -Q "sp_addrolemember 'db_owner', 'COMPUTERNAME\ASPNET'"

This discussion is closed to new replies.