Web.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="Location" value="tyfo" />
<!--add key="Location" value="tyfo" /-->
<!--add key="Location" value="wlmq" /-->
<!--add key="Location" value="wuhan" /-->
<!--add key="Location" value="sjz" /-->
<!--此数据库连接字符串,不同的地方,数据库连接字符串不一样-->
<add key="DBConn" value="server=192.168.1.1;Database=****;UID=*****;PWD=******;" />
</appSettings>
****************************************************************
public static string ConnectionString
{
get
{
switch (System.Configuration.ConfigurationSettings.AppSettings["Location"])
{
case "tyfo"://成都本地
return "server=192.168.1.1;database=*****;uid=******;pwd=******;";
case "wlmq"://上传到新疆
return System.Configuration.ConfigurationSettings.AppSettings["DBConn"];
default:
return "";
}
}
}
****************************************************************