简体   繁体   English

远程服务器上的sql数据库连接

[英]sql database connection on remote server

我在asp.net上创建我的网站,并使用Visual Studio中的内置数据库在sql中创建数据库,我使用步骤来创建数据库1.右键单击解决方案资源管理器,然后添加newSqldatabase,然后确定,如果我通过编码将其连接,那么它将起作用在我的本地PC上,但是实际上我正在建立网站,所以我想将其存储在我的Web服务器上,然后如果我在所有文件都已加载的Web服务器上加载了databse文件(.mdf)文件,则显示错误“网络建立与SQL Server的连接时发生与相关的错误或特定于实例的错误。找不到服务器或无法访问该服务器。请验证实例名称正确并且已将SQL Server配置为允许远程连接。(提供者:SQL网络接口) ,错误:26-错误指定了服务器/实例的位置)”,所以请帮助我并将我创建数据库的方式以及我用来连接远程服务器的编码使用的所有步骤发送给我。......谢谢..... 。

You'll want to look up connection strings to become familiar with the format of them, then it's basically a case of making sure your parameters are correct. 您将需要查找连接字符串以熟悉它们的格式,这基本上是确保您的参数正确的一种情况。

Check out http://www.connectionstrings.com/sql-server-2005 . 查看http://www.connectionstrings.com/sql-server-2005

The connection strings are typically stored in web.config. 连接字符串通常存储在web.config中。 Some examples are here: 一些示例在这里:

http://weblogs.asp.net/owscott/archive/2005/08/26/Using-connection-strings-from-web.config-in-ASP.NET-v2.0.aspx http://weblogs.asp.net/owscott/archive/2005/08/26/Using-connection-strings-from-web.config-in-ASP.NET-v2.0.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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