简体   繁体   English

是否可以允许用户从已发布的Web应用程序连接到自己的数据库?

[英]Is it possible to allow users to connect to their own database from a published web application?

I started working on a .net app that would allow users to make a connection to their own Sql Server database. 我开始研究.net应用程序,该应用程序允许用户建立与自己的Sql Server数据库的连接。 Is this even possible? 这有可能吗? None of the db information would be saved, it would just be used to connect and allow them to use their own stored procedures in the application rather than predefined/fake data. 不会保存任何数据库信息,它仅用于连接并允许他们在应用程序中使用自己的存储过程,而不是预定义/伪造的数据。

You can indeed! 你确实可以!

If you know which connection string should be used for each user to connect to the corresponding database, instead of connecting to one database using it's connection string (like we see in every basic example), use the user's connection string and open the connection with it. 如果您知道应该为每个用户使用哪个连接字符串来连接到相应的数据库,而不是使用该数据库的连接字符串来连接到一个数据库(就像我们在每个基本示例中看到的那样),请使用该用户的连接字符串并打开与它的连接。

As long as you set the SQLConnection with the wanted connection string you can connect each time to another DB, easily. 只要使用所需的连接字符串设置SQLConnection,就可以轻松地每次都连接到另一个DB。

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

相关问题 允许用户从asp.net Web应用程序从Subversion下载文件 - Allow users to download files from subversion from a asp.net web application 从我的Web应用程序连接到本地sql express数据库 - Connect to local sql express database from my web application 在已发布的Web应用程序中通过ODBC连接到Progress数据库的问题 - Issues connecting to Progress database via ODBC in published Web Application 从web.config获取允许用户 - Getting allow users from web.config 已发布的Web应用程序部署中的部分ASP.NET WEB - Partial ASP.NET WEB FROM Published Web Application Deployment 如何将 Visual Studio 中的 localdb 连接到已发布的 Azure Web 应用程序? - How to connect a localdb from Visual Studio to the published Azure web app? 您如何允许用户编辑Web应用程序中的附件? - How would you allow users to edit attachments in a web application? 从已发布的ASP.NET应用程序连接到数据库的奇怪问题 - Strange problem connecting to a database from a published ASP.NET application 如何在 C# web 应用程序中连接到数据库 - How to connect to Database in C# web application 如何将托管的Web应用程序与本地数据库连接? - How to connect a hosted Web Application with a local database?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM