If you have copies the database from your machine to another you may need to change the security.
Bizarrely, if the target server has the same login credentials as the newly attached database, they do not sync. You have to remove the previous credentials and add them back from the server creds.
As you're using Trusted_Connection=True, check the windows account is set up on the db and that it has access writes (or is owner or whatever) of the attached database.
This is an annoyance I have to go through with EVERY db deployment I do >_<
Hope that helps ^_^
Andy
UPDATE:
Step by step:
- Open MSSQL Management Studio
- Find the database and expand
- Expand Security / Users
- Delete the windows user account
- Under the server:
- Expand Security / Logins
- If the users windows account is there appear:
- Right Click and select Properties
- If the account is not there:
- Right click the Logins folder
- Select New Login
- Add the windows user account
- Go to User Mapping on the left
- check the database to add them to
- select the roles they should have
- Click OK
br mode="hold" />If all goes to plan then the windows user should be added to the database and the Trusted_Connection=True; should now work