简体   繁体   中英

Correct connection string MS sql server database 2008

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$'.

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".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM