2
Answers

SqlConnection - Error

anuimago

anuimago

18y
2.7k
1
Hi,

I am new to ADO.net. My SQL Query Analyser uses the Windows Authentication, not SQL Server Authentication. In this case, How should my SQLConnection statement be in ADO.Net? Pls tell me.

Because,

When I tried to open the connection by using the following

SqlConnection cn = new SqlConnection("Server=(local); Initial Catalog=pubs; uid=sa; pwd= ");

the error occurs as

Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server Connection.

Pls let me know what will be solution for this.

Thanx in advance.
Answers (2)