在应用程序设置期间获取数据库名称和登录详细信息并从应用程序中读取它们

发布于 2024-10-10 03:25:17 字数 177 浏览 0 评论 0原文

我创建了一个 SharePoint Web 部件。 Web 部件使用自定义数据库。在安装 Web 部件期间,我获取数据库名称和用于访问数据库的登录详细信息。我需要读取应用程序安装期间给出的这些值并连接到数据库。

我可以在哪里存储/检索这些值?由于我的应用程序驻留在 ASP.NET Web 应用程序中,我如何轻松实现此目标?

I've created a SharePoint web part. The web part makes use of a custom database. During installing my web part I get the database name and the login details for accessing the database. I need to read these values given during the installation in my application and connect to the database.

Where I can store/retrieve these values? Since my application resides inside an asp.net web application how easily can I achieve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

虚拟世界 2024-10-17 03:25:17

我建议您完全避免使用 SPPersistedObject,并将内容存储在服务器场、Web 应用程序或站点级别的 SPPropertyBag 中。

此答案中提供了更多详细信息,包括代码示例的链接,例如 MSDN - SharePoint 指导库。

SO - 从分层对象读取/写入商店 - SharePoint

I would recommend that you avoid the SPPersistedObject altogether and store things in the SPPropertyBag at the farm, web app or site level.

More details why in this answer, including links to code samples such as the MSDN - SharePoint Guidance library.

SO - Read/Write from/to Hierarchical Object Store - SharePoint

病女 2024-10-17 03:25:17

SharePoint SPWebApplication(实际上,它是基础 SPPersistedObject)有一个 Properties 属性(它是一个 PropertyBag / HashTable),您可以在其中存储值。我建议将您的连接数据存储在那里。

A SharePoint SPWebApplication (well actually, it's base SPPersistedObject) has a Properties property (it's a PropertyBag / HashTable), in which you can store values. I suggest storing your connection data in there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文