如何通过用户登录将一个数据库的连接字符串更改为另一个数据库 [英] How to change a connection string a one database to another database by user login
本文介绍了如何通过用户登录将一个数据库的连接字符串更改为另一个数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨......
晚上好...
我在asp.net 3.5中开发了一个网站.我想通过用户选择在一个财政年度将数据库动态更改为另一个数据库.我已将web.config用于默认数据库.
Hi....
Good evening...
I have develop a website in asp.net 3.5.I want to change the connection string in dynamic by user selection financial year one Database to Another database.I have use web.config for Default database.
<appSettings>
<add key="conInfo" value="Data Source=SERVER;Initial Catalog=Tryal_DB;User Id=sa;Password=dev12345"/>
</appSettings>
并使用代码
and use a code
public class ConnectionInfo
{
public static string info
{
get
{
return ConfigurationSettings.AppSettings["conInfo"];
}
}
}
如何通过用户登录将一个数据库的连接字符串更改为另一个数据库.
请帮帮我.
谢谢
Debapriya
How to change a connection string a one database to another database by user login.
Please help me.
Thank You,
Debapriya
推荐答案
使用IF子句更改它是什么问题,并在Web.Config文件中添加更多连接字符串!
Change it using IF clause whats the issue and , make more connecting string in Web.Config file !
这篇关于如何通过用户登录将一个数据库的连接字符串更改为另一个数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文