简体   繁体   English

连接到外部SQL Server数据库

[英]Connecting to external SQL Server database

I developed an application using VS 2012 that needs to be run with an external database. 我使用VS 2012开发了一个应用程序,该应用程序需要与外部数据库一起运行。 I have a password and a username which had been created where I can login to the portal interface from my desktop and run select queries or access information. 我有一个密码和一个用户名,该密码和一个用户名已创建,可以从我的桌面登录到门户网站界面并运行选择查询或访问信息。 Once I tried to connect my VS to their server, it seems the web service is locked down to any connection. 一旦我尝试将VS连接到他们的服务器,似乎Web服务就被锁定为任何连接。

My question is there anyway I can link my application within the VS solution to that database? 我的问题是,无论如何,我可以将VS解决方案中的应用程序链接到该数据库吗? Appreciate any help/suggestions. 感谢任何帮助/建议。

You just need to change your connection string for connecting the remote database. 您只需要更改连接字符串即可连接远程数据库。 Your database server provider will provide you the connection string details. 您的数据库服务器提供商将为您提供连接字符串的详细信息。

So, Go ahead and modify your connection string in the project and have fun! 因此,继续并在项目中修改您的连接字符串,玩得开心!

This is very simple in your visual studio in view tab open server explorer and click connect to database in this choose sql server authentication and add your username and password in it. 这在Visual Studio中的视图选项卡中打开服务器资源管理器中非常简单,然后单击“连接到数据库”(在此选择sql服务器身份验证并在其中添加用户名和密码)。 Once database is connected Right click the database name and view property it contains connection string replace this connection string with your web.config connection string and then it works fine. 连接数据库后,右键单击数据库名称和视图属性,其中包含连接字符串,用您的web.config连接字符串替换此连接字符串,然后即可正常工作。

Also review below link Connect to SQL Server 还请查看下面的链接连接到SQL Server

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

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