如何在单个应用程序中使用多个DB [英] How to use multiple DB in single application

查看:84
本文介绍了如何在单个应用程序中使用多个DB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想为单个应用程序使用多个数据库连接。登录用户将有一个集中的数据库,连接字符串应根据输入的用户名和密码进行更改。此外,我还需要在登录时从集中式数据库获取该连接字符串。我不知道这样做...指导我可能的解决方案

Hi,
I want to use multiple database connections for single application. There will be a centralized database for login users, and the connection string should be change according to username and password entered. Also i need to get that connection string also from the centralized database while login. I dont have idea to do this...guide me with possible solution

推荐答案

解决方案将简单如下

1)添加连接web.config中集中式数据库的字符串。在登录用户时使用它。

2)将用户特定连接字符串存储在另一列或另一个表中的用户登录详细信息表中。

3)用户登录期间获取具有特定连接字符串的用户数据并将其存储在会话中。

4)进一步使用会话中的连接字符串并执行操作。
Solution will be simple as below
1) Add connection string for centralized db in web.config. & use it while login user in.
2) Store user specific connection string in user login details table in another column or in another table.
3) During user log in get user data with specific connection string & store it in session.
4) Further use the connection string from session & do your actions.


您只需要根据用户详细信息更改连接字符串。

查看以下链接

将多个数据库绑定到单个DataGridView [ ^ ]



如何使用ASP.Net C#Application处理多个SqlServer 2005数据库[ ^ ]
You just needs to change connection string as per user details.
Check below links
Bind multiple databases to a single DataGridView[^]

How to work with Multiple SqlServer 2005 databases with ASP.Net C# Application[^]


这篇关于如何在单个应用程序中使用多个DB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆