I've got an SQL Server 2008 Express set up on one machine and am trying to connect with my C# app to the server from another machine (both Win 7). The server machine has a user account for me in the system. The SQL Server is configured to use Windows Authentication. Firewall on the server machine has inbound rules to accept ports 1433 for TCP and 1434 for UDP and also accept the server's exe.
The problem: I cannot connect to the server. Whatever connection string I use I get errors:
System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'SERVINGMACHINE\wally'.
or
System.Data.SqlClient.SqlException (0x80131904): Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
An example of my connection string:
SqlConnection myConnection = new SqlConnection("Integrated security=true;" +
@"user id=SERVERMACHINE\wally;" +
//"password=testpasswd;" +
@"server=10.127.40.1,1433\SQLEXPRESS;" +
"Trusted_Connection=true;" +
"database=nscm_db; " +
"connection timeout=30");
I've commented out the password since it's allegedly not used for trusted connection.
When the app and the server are on the same machine the connection works fine.
What am I doing wrong?