My database is hosted on a remote server. I need to write the connection string which I have to include in the web.config
file.
server name -- abcs.efgh.ed-1.eee.sss.com,1433 (it also contains a port as well)
username -- a
password -- a
db name -- mydb
I know how to connect to a local database and I use to refer to connectionstring.com for reference but, connecting to a remote database is a problem to me. Help please
UPDATE:
<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient"
connectionString="abcs.efgh.ed-1.eee.sss.com,1433;Integrated Security=True;User ID=a;Password=a" />
</connectionStrings>
Exception I get is :
Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.
Actually, it's not Windows authentication that I want to use. It's SQL Server authentication which I want.
You are encountering the error because you are using "integrated security=true" to connect. Use this website to construct your connection string. http://www.developerfusion.com/tools/sql-connection-string/
I used the website to generate this connection string using your inputs:
Data Source=abcs.efgh.ed-1.eee.sss.com,1433;Initial Catalog=mydb;Integrated Security=False;User ID=a;Password=a
Put Integrated security =false.
in connection string
When false, User ID and Password are specified in the connection. When true, the current Windows account credentials are used for authentication. Recognized values are true, false, yes, no, and sspi (strongly recommended), which is equivalent to true. If User ID and Password are specified and Integrated Security is set to true, the User ID and Password will be ignored and Integrated Security will be used. SqlCredential is a more secure way to specify credentials for a connection that uses SQL Server Authentication (Integrated Security=false).
More at Here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With