简体   繁体   中英

Cannot Connect To Remote Sql Server With ConnectionString

I'm developing a Winform project that needs to connect to a remote Sql server. I'm using Entity Framework as ORM. Here is my connectionstring

<add name="RemoteConnection" connectionString="Data Source=*****;Initial Catalog=****;User Id=****;Password=*****;Integrated Security=True;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />

I get the following error when i want to connect remote sql server

Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

Everything works fine with SQL server management studio, i'm able to see databases and have access to them, but when in comes to code i get error

User Id=****;Password=*****;Integrated Security=True

is wrong. If you want to use Integrated security, you should not pass any credential (leave only Integrated security= True ).

If instead you want to use SQL Server login (+ password), pass only them and exclude Integrated security= 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