在两个帐套进行切换,如何来适应多用户
我在一个页面的代码如下:
protected void HNKD_Click(object sender, EventArgs e)
{
Maticsoft.DBUtility.DbHelperSQL.factorychoice("KD");
Session["factory"] = "康达电子";
Response.Redirect("Main.aspx");
}
protected void HNBD_Click(object sender, EventArgs e)
{
Maticsoft.DBUtility.DbHelperSQL.factorychoice("BD");
Session["factory"] = "博禄德电子";
Response.Redirect("Main.aspx");
}
用来切换连接字符串,,其中 Maticsoft.DBUtility.DbHelperSQL 的代码如下
public abstract class DbHelperSQL
{
//数据库连接字符串(web.config来配置),多数据库可使用DbHelperSQLP来实现.
public static string connectionString = PubConstant.ConnectionString;
public DbHelperSQL()
{
}
/// <summary>
/// 进行工厂别的切换
/// </summary>
public static void factorychoice(string factory)
{
switch (factory)
{
case "KD":
connectionString = PubConstant.ConnectionString;
break;
case "BD":
connectionString = PubConstant.ConnectionString2; ;
break;
}
}
我感觉我这样子用static,只适合一个用户,如果是多用户, 肯定不行,
那代码如何改成适应多用户的,切换帐套呢
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------
------解决方案--------------------