关于连接字符串 [英] Regarding the connection string

查看:90
本文介绍了关于连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的代码文件如下所示....

hi all,

my code file is given below....

protected void Page_Load(object sender, EventArgs e)
   {
       ConnectionInfo con = new ConnectionInfo();
       con.ServerName = "HHDVAQUAS";
       con.DatabaseName = "Current";
       con.UserID = "sa";
       con.Password = "samesame";

       CrystalReportViewer1.ParameterFieldInfo.Clear();
       CrystalReportViewer1.ReportSource = Server.MapPath("Report/RptGpsCustomerList.rpt");
       ParameterFields parameter = CrystalReportViewer1.ParameterFieldInfo;
       ParameterField strid = new ParameterField();
       strid.Name = "@strIDs";
       ParameterDiscreteValue par_custid_value = new ParameterDiscreteValue();
       par_custid_value.Value = Session["stID"].ToString();
       strid.CurrentValues.Add(par_custid_value);
       parameter.Add(strid);
       ParameterField intFilterType = new ParameterField();
       intFilterType.Name = "@intFilterType";
       ParameterDiscreteValue par_intFilterType_value = new ParameterDiscreteValue();
       par_intFilterType_value.Value = Convert.ToInt16(Session["ReportBy"].ToString());
       intFilterType.CurrentValues.Add(par_intFilterType_value);
       parameter.Add(intFilterType);
       foreach (TableLogOnInfo tlf in CrystalReportViewer1.LogOnInfo)
       {
           tlf.ConnectionInfo = con;
       }



上面的代码可以正常工作..但是,每当我将页面部署到其他m/c上时,每次必须更改此代码中的连接信息.
我想通过我的web.config文件提供连接.

请帮助我



The above code is working ..but every time i have to change connection Information in this code when i deploy my page on other m/c.
i want to provide the connection by my web.config file.

please help me

推荐答案

此链接
This Link Web.Config Connection String Settings[^] May help you.


这篇关于关于连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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