sha*_*Hwk 6 c# sql-server asp.net database-connection web-config
我的数据库托管在远程服务器上.我需要编写我必须包含在web.config文件中的连接字符串.
server name -- abcs.efgh.ed-1.eee.sss.com,1433 (it also contains a port as well)
username -- a
password -- a
db name -- mydb
Run Code Online (Sandbox Code Playgroud)
我知道如何连接到本地数据库,我用来引用connectionstring.com作为参考,但是连接到远程数据库对我来说是一个问题.请帮忙
更新:
<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>
Run Code Online (Sandbox Code Playgroud)
我得到的例外是:
登录失败.登录来自不受信任的域,不能与Windows身份验证一起使用.
实际上,我不想使用Windows身份验证.这是我想要的SQL Server身份验证.
Jay*_*Jay 12
您遇到错误,因为您使用"integrated security = true"进行连接.使用此网站构建您的连接字符串.http://www.developerfusion.com/tools/sql-connection-string/
我使用网站使用您的输入生成此连接字符串:
Data Source=abcs.efgh.ed-1.eee.sss.com,1433;Initial Catalog=mydb;Integrated Security=False;User ID=a;Password=a
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
30121 次 |
| 最近记录: |