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)
0
Venkata Sirish

Venkata Sirish

NA 4 0 18y
Hi I think it should be as follows.. "Data Source=Aron1;Initial Catalog=pubs;Integrated Security=SSPI;" - or - "Server=Aron1;Database=pubs;Trusted_Connection=True;" For more information check www.Connectionstrings.com
0
anuimago

anuimago

NA 6 0 18y
Hi,

I got the answer from the following link, It was really useful to me. If u want, u can refer this web-site for future reference.

http://www.scriptlogic.com/support/kb/displayarticle.asp?UID=564

Thanx scriptlogic.com