Connect c# to a SQL Server in different domain

I have an c# app that tries to connect to a SQL Server that is in the same network but out of domain. I'm trying to use SqlConnection (I would prefer not use ODBC or ole db). My code is the follow:

con.ConnectionString =
"Server=PCXSQL;"+
"Initial Catalog=BBDD_SinGuid;"+
"User id=\PCXuser;"+
"Password=passwordofuser;";

And I'm sure that the user and the password are correct and are allow to connect to the SQL Server. The error that throws is a fail in the login with the user PCXuser.

I'm missing something?


you need to add trusted connectioon here..

Provider=SQLNCLI10;Server=myServerNametheInstanceName;Database=myDataBase; Trusted_Connection=yes;

for more information you check below link it's has lot's of suggestion may be you will get your answer.

http://www.connectionstrings.com/sql-server-2008/

链接地址: http://www.djcxy.com/p/74080.html

上一篇: 如何通过模拟连接到sql server?

下一篇: 将c#连接到不同域中的SQL Server