0

Was hoping for a little help with my connection string to ms sql server 2008 database.

Server Type: Database Engine

Sever name: MyServer

Authentication: Windows Authentication

User Name VAW\Username

the connection string I am using at the moment is as follow

<add name="Name" connectionString="Data Source=111.111.1.1;Initial Catalog=HRElearning;MultipleActiveResultSets=True;Trusted_Connection=true;" providerName="System.Data.EntityClient" />

Error I am getting is System.Data.SqlClient.SqlException: Login failed for user 'VAW\MAWSON$'.

3
  • you need to add user name and password as well to your connection string Commented Oct 7, 2014 at 8:32
  • @Arianule It may help you : stackoverflow.com/questions/21180474/… Commented Oct 7, 2014 at 8:50
  • It may be helpful for you to use connection string creator in VS rather than trying to put it together manually. If you use visual studio go to 'Tools' and select 'Connect to database...' this will take you to wizard. It gives you option to test your connection too and saves created connection string in config file. Commented Oct 7, 2014 at 10:09

1 Answer 1

1

I to agree using VS is the better way to go, but to understand connectionstrings in general, here is the site that explains it. Once you understand exactly what is going on, freehanding them is not difficult.

The connection string you have assumes the user you are running the app with is the user you want to connect with. If you want to run app with UserA and connect with UserB then you must specify the username and password and remove "Trusted_Connection=true".

Sign up to request clarification or add additional context in comments.

1 Comment

Excellent thanks. The problem was a permissions issue on the server the IT man helped me sort out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.