Login failed for user ''

Posted by Ujjal under Sql Server on 4/6/2012 | Points: 10 | Views : 1606 | Status : [Member] | Replies : 8
I am getting the following error in my client system while trying to connect the server :-

Login failed for user ''.The user is not associated with a trusted sql server connection.

I am using sql server 2005 management studio express and c#.net.

Below is my connection string :-

public SqlConnection con = new SqlConnection(@"data source=IP of server\SQLEXPRESS;User Id=sa;Initial Catalog=dbsaiscan;Integrated Security=True;Persist Security Info=True;Trusted_Connection=Yes");


Any help wiill be highly appreciated.

Thanks
Ujjal




Responses

Posted by: Sakthi.Singaravel on: 4/6/2012 [Member] Silver | Points: 25

Up
0
Down
Giv this format..
SqlConnection myConnection = new SqlConnection("user id=username;" +
"password=password;server=serverurl;" +
"Trusted_Connection=yes;" +
"database=database; " +
"connection timeout=30");

Link:

http://www.codeproject.com/Articles/4416/Beginners-guide-to-accessing-SQL-Server-through-C

Regards,
Singaravel M

Ujjal, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/6/2012 [Member] Silver | Points: 25

Up
0
Down
I think this also used for u..

http://www.dofactory.com/Connect/Connect.aspx#sqlserver

Regards,
Singaravel M

Ujjal, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ujjal on: 4/6/2012 [Member] Starter | Points: 25

Up
0
Down
@Singaravel Thnx for your reply but i have tried the above code and still d same problem persists.

Ujjal, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/6/2012 [Member] Silver | Points: 25
Posted by: Mani5155 on: 4/10/2012 [Member] Starter | Points: 25

Up
0
Down
try this
http://blog.sqlauthority.com/2008/04/09/sql-server-2005-connection-strings-for-net/

Top Forums Authors
Tue, 24-Oct-2017 Authors
All Time Authors
Jayakumars
6050
Karthikanbarasan
3455
Oswaldlily
3300

Latest members | More ...


(Statistics delayed by 5 minutes)
Advertisements