Пример #1
0
 private void InitiData()
 {
     List<Detail_CAW_TABLEINFO> DataList = new CawReportDB().GetSet(Request.QueryString["template"]);
     this.txtParaName.Text = DataList[0].PARANAME;
     this.txtsql.Text = DataList[0].DATASQL;
     this.txtTemplate.Text = DataList[0].REPORTTEMPLATE;
     this.txtSource.Text = DataList[0].DATASETNAME;
 }
Пример #2
0
        /// <summary>
        /// 选择数据
        /// </summary>
        protected void refresh()
        {
            DataView dv = new CawReportDB().GetReportInfo();
            GridView1.DataSource = dv;
            GridView1.DataBind();

            //调用一个js函数,用于强制执行datagrid的颜色变换。如不用,因updatapanel中数据更新后将无法引起datagridcolor.js的执行
            CallJsFun("ChangeColor();");
        }
Пример #3
0
        private void InitiReport()
        {
            if (Request.QueryString["template"] == null || Request.QueryString["wherevalue"] == null)
            {
                CallJsFun("alert('地址栏参数传递错误');window.close();");
                return;
            }
            try
            {
                List<Detail_CAW_TABLEINFO> DataList = new CawReportDB().GetSet(Request.QueryString["template"]);
                if (DataList.Count < 1)
                {
                    CallJsFun("alert('报表信息还未配置或者配置错误');window.close();");
                    return;
                }
                string[] WhereValue = Request.QueryString["wherevalue"].Replace("*","'").Split(',');

                DataTable rptData = new CawReportDB().GetReportData(String.Format(DataList[0].DATASQL, WhereValue));
                this.ReportViewer1.LocalReport.ReportPath = Server.MapPath("../../ReportTemplate/" + DataList[0].REPORTTEMPLATE);
                this.ReportViewer1.LocalReport.DisplayName = DataList[0].TABLE_NAME_CN;

                ReportDataSource rds = new ReportDataSource(DataList[0].DATASETNAME, rptData);
                ReportViewer1.LocalReport.DataSources.Clear();
                if (Request.QueryString["paravalue"] != null)
                {
                    string[] ParaValue = Request.QueryString["paravalue"].Split(',');
                    string[] ParaName = DataList[0].PARANAME.Split(',');
                    if (ParaValue.Length != ParaName.Length)
                    {
                        CallJsFun("alert('参数字段传递错误');window.close();");
                        return;
                    }
                    ReportParameter[] para = new ReportParameter[ParaName.Length];
                    for (int i = 0; i < ParaValue.Length; i++)
                    {
                        para[i] = new ReportParameter(ParaName[i], ParaValue[i]);
                    }
                    ReportViewer1.LocalReport.SetParameters(para);
                }
                ReportViewer1.LocalReport.DataSources.Add(rds);
                ReportViewer1.LocalReport.Refresh();
            }
            catch
            {
                CallJsFun("alert('报表信息还未配置或者配置错误');window.close();");
            }
        }