(I know there's a ton of questions like this on the web and I've spent several days now trying to solve this, but I'm not getting anywhere. I'm new to this so bear with me please)
1. The problem
After installing my application, SQL Server 2005 Express on my friends computer (Vista Home Premium) and attaching the database (mdf file) to the new SQL server whenever I launch my application or open a new form (C# windows form) inside the application I get the following message:
System.Data.SqlClient.SqlException: Login failed for user ''. The user is not associated with a trusted SQL Server connection.
If I click "continue" I can read/write to the database and the application works as expected (untill I open a new form and i get the same message again).
2. So this is what I've done so far:
I've turned "SQL Server and Windows Authentication mode" on since I've seen that being suggested in many threads, but it doesn't help.
My current connection string:
"Data Source=.\SQLEXPRESS;Initial Catalog=pj;Integrated Security=SSPI;"
Since my connection string contains ".\SQLEXPRESS" it will try to connect with "computer-name\username", in my case "TONY-COMPUTER\TONY", so I added a SQL user with that name together with role memberships db_datareader and db_datawriter to be able to read/write to DB.
I also tried with a connection string like:
"Data Source=.\SQLEXPRESS;Initial Catalog=pj;User Id=Tony;Password=123;"
Then added the SQL user "Tony".
But I keep getting the same error. What puzzles me is that there's no user name in the error message, I'd expect to see "TONY-COMPUTER\TONY" or "Tony" but it's blank.
Any help much appreciated!
/Tony
*look good in the question say when used to represent the multiplication operations - V4Vendetta