当前位置: 首页>>代码示例>>C#>>正文


C# ReportDocument.SetDataSource方法代码示例

本文整理汇总了C#中ReportDocument.SetDataSource方法的典型用法代码示例。如果您正苦于以下问题:C# ReportDocument.SetDataSource方法的具体用法?C# ReportDocument.SetDataSource怎么用?C# ReportDocument.SetDataSource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ReportDocument的用法示例。


在下文中一共展示了ReportDocument.SetDataSource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnGerar_Click

        private void btnGerar_Click(object sender, EventArgs e)
        {
            ReportDocument crDocument = new ReportDocument();
            crDocument.Load(Application.StartupPath + @"\..\..\RelLocalizacaoProcesso.rpt");

            if (rbSemFiltro.Checked)
            {
                crDocument.SetDataSource(new RelProcesso(new Banco()).semfiltro());
            }
            else if (ckbNome.Checked && !ckbSituacao.Checked)
            {
                crDocument.SetDataSource(new RelProcesso(new Banco()).porNome(ttbNome.Text));
            }
            else if (!ckbNome.Checked && ckbSituacao.Checked)
            {
                //if(cbbSituacao.SelectedText == "Em Pasta")
                //    crDocument.SetDataSource(new RelProcesso(new Banco()).emPasta()));
                //else
                //    crDocument.SetDataSource(new RelProcesso(new Banco()).arquivado()));
            }
            else if (ckbNome.Checked && ckbSituacao.Checked)
            {

            }

            frmVisualizador f = new frmVisualizador();
            f.carregar(crDocument);
            f.ShowDialog();
        }
开发者ID:mariomarques123,项目名称:esi,代码行数:29,代码来源:frmRelatorioLocalizacaoProcesso.cs

示例2: btnIncluir_Click

        private void btnIncluir_Click(object sender, EventArgs e)
        {
            ReportDocument crDocument = new ReportDocument();
            crDocument.Load(Application.StartupPath + @"\..\..\RelContasPagar.rpt");

            if (rbSemFiltro.Checked)
            {
                crDocument.SetDataSource(new RelContas(new Banco()).semFiltro());
            }
            else if (ckbPeriodo.Checked && !ckbTipo.Checked)
            {
                crDocument.SetDataSource(new RelContas(new Banco()).porDataVenc(dtpIni.Value, dtpFim.Value));
            }
            else if (!ckbPeriodo.Checked && ckbTipo.Checked)
            {
                crDocument.SetDataSource(new RelContas(new Banco()).porPagas(cbbTipo.Text));
            }
            else if (ckbPeriodo.Checked && ckbTipo.Checked)
            {
                crDocument.SetDataSource(new RelContas(new Banco()).porDataVencPagas(dtpIni.Value, dtpFim.Value,cbbTipo.Text));
            }

            frmVisualizador f = new frmVisualizador();
            f.carregar(crDocument);
            f.ShowDialog();
        }
开发者ID:mariomarques123,项目名称:esi,代码行数:26,代码来源:frmRelatorioContasPagar.cs

示例3: btnIncluir_Click

        private void btnIncluir_Click(object sender, EventArgs e)
        {
            ReportDocument crDocument = new ReportDocument();
            crDocument.Load(Application.StartupPath + @"\..\..\Relatorios\Crystal\RelTransacoesBancarias.rpt");

            if (rbSemFiltro.Checked)
            {
                crDocument.SetDataSource(new RelTransacoes(new Banco()).semFiltro());
            }
            else if (ckbPeriodo.Checked && !ckbTipo.Checked)
            {
                crDocument.SetDataSource(new RelTransacoes(new Banco()).porPeriodo(dtpIni.Value,dtpFim.Value));
            }
            else if (!ckbPeriodo.Checked && ckbTipo.Checked)
            {
                crDocument.SetDataSource(new RelTransacoes(new Banco()).porTipo(cbbTipo.Text[0]));
            }
            else if (ckbPeriodo.Checked && ckbTipo.Checked)
            {
                crDocument.SetDataSource(new RelTransacoes(new Banco()).porPeriodoTipo(dtpIni.Value, dtpFim.Value,cbbTipo.Text[0]));
            }

            frmVisualizador f = new frmVisualizador();
            f.carregar(crDocument);
            f.ShowDialog();
        }
开发者ID:mariomarques123,项目名称:esi,代码行数:26,代码来源:frmRelatorioTransacoesBancarias.cs

示例4: Page_Init

        protected void Page_Init(object sender, EventArgs e)
        {
            //if (!IsPostBack)
            //{
                int temp;

                if (Request["tipo"] != null && int.TryParse(Request["tipo"].ToString(), out temp)
                    && (int.Parse(Request["tipo"].ToString()) == 1 || int.Parse(Request["tipo"].ToString()) == 2)
                    && Request["codigo"] != null && int.TryParse(Request["codigo"].ToString(), out temp))
                {
                    ReportDocument doc = new ReportDocument();
                    Hashtable hash = null;

                    if (int.Parse(Request["tipo"].ToString()) == 1) //Movimentação
                    {
                        IList<Movimento> lm = new List<Movimento>();
                        lm.Add(Factory.GetInstance<IMovimentacao>().BuscarPorCodigo<Movimento>(int.Parse(Request["codigo"].ToString())));
                        hash = Factory.GetInstance<IMovimentacao>().RetornaHashMovimentacaoRemanejamento<IList<Movimento>>(int.Parse(Request["tipo"].ToString()), lm);

                        DSCorpoMovimentacao dsc = new DSCorpoMovimentacao();
                        DSCabecalhoMovimentacao dscab = new DSCabecalhoMovimentacao();

                        dsc.Tables.Add((DataTable)hash["corpo"]);
                        dscab.Tables.Add((DataTable)hash["cabecalho"]);

                        doc.Load(Server.MapPath("RelatoriosCrystal/RelMovimentacao.rpt"));
                        doc.SetDataSource(dscab.Tables[1]);
                        doc.Subreports[0].SetDataSource(dsc.Tables[1]);

                        CrystalReportViewer_Relatorio.ReportSource = doc;
                        CrystalReportViewer_Relatorio.DataBind();
                    }
                    else //Remanejamento
                    {
                        IList<RemanejamentoMedicamento> lrm = new List<RemanejamentoMedicamento>();
                        lrm.Add(Factory.GetInstance<IMovimentacao>().BuscarPorCodigo<RemanejamentoMedicamento>(int.Parse(Request["codigo"].ToString())));
                        hash = Factory.GetInstance<IMovimentacao>().RetornaHashMovimentacaoRemanejamento<IList<RemanejamentoMedicamento>>(int.Parse(Request["tipo"].ToString()),lrm);

                        DSCorpoRemanejamento dsr = new DSCorpoRemanejamento();
                        DSCabecalhoRemanejamento dsc = new DSCabecalhoRemanejamento();

                        dsr.Tables.Add((DataTable)hash["corpo"]);
                        dsc.Tables.Add((DataTable)hash["cabecalho"]);

                        doc.Load(Server.MapPath("RelatoriosCrystal/RelRemanejamento.rpt"));
                        doc.SetDataSource(dsc.Tables[1]);
                        doc.Subreports[0].SetDataSource(dsr.Tables[1]);

                        CrystalReportViewer_Relatorio.ReportSource = doc;
                        CrystalReportViewer_Relatorio.DataBind();
                    }
                }
            //}
        }
开发者ID:vivermais,项目名称:vivermais,代码行数:54,代码来源:FormImprimirMovimentoRemanejamento.aspx.cs

示例5: ConfigureCrystalReports

    /// <summary>
    /// 產生報表
    /// </summary>
    private void ConfigureCrystalReports()
    {
        try
        {
            string strDate = Session[string.Format("{0}QueryDateRange", Request["TimeStamp"].ToString())].ToString();
            if (strDate == "~") strDate = "";
            string strTime = Session[string.Format("{0}QueryTimeRange", Request["TimeStamp"].ToString())].ToString();
            if (strTime == "~") strTime = "";
            customerReport = new ReportDocument();

            //取得報表格式檔RPT
            customerReport.Load(Server.MapPath("ITM061R.rpt"));
            customerReport.SetDataSource((DataTable)Session[string.Format("{0}ITM061", Request["TimeStamp"].ToString())]);
            ParameterFields par1 = new ParameterFields();
            AddParameter("ProgramName", PageProgramName, par1);
            ParameterFields par2 = new ParameterFields();
            AddParameter("UserName", Session["UID"].ToString(), par2);
            ParameterFields par3 = new ParameterFields();
            AddParameter("QueryDateRange", strDate, par3);
            ParameterFields par4 = new ParameterFields();
            AddParameter("QueryTime", strTime, par4);
            CRV1.ParameterFieldInfo.Add(par1[0]);
            CRV1.ParameterFieldInfo.Add(par2[0]);
            CRV1.ParameterFieldInfo.Add(par3[0]);
            CRV1.ParameterFieldInfo.Add(par4[0]);
            CRV1.ReportSource = customerReport;
        }
        catch (Exception ex)
        {
            lblErrorMessage.Text = ex.Message;
        }
    }//ConfigureCrystalReports
开发者ID:ChiangHanLung,项目名称:PIC_VDS,代码行数:35,代码来源:ITM061R.aspx.cs

示例6: btninfoBitacora_Click

    protected void btninfoBitacora_Click(object sender, EventArgs e)
    {
        string Ciclo = this.ddlCiclo.SelectedValue;
        DBEstadisticas.Escolar db = new DBEstadisticas.Escolar();

        var Bitacora = (from P in db.Bitacora
                        where P.Ciclo == Ciclo
                        group P by new { P.Z, P.P, P.Descripcion } into g
                        select new { Z = g.Key.Z, P = g.Key.P, g.Key.Descripcion, Fecha = g.Max(x => x.Fecha) }).OrderByDescending(x => x.Fecha).ToList();

        if (Bitacora.Count == 0)
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", string.Format("alert('{0}');", "No hay registros encontrados"), true);
            return;
        }

        ReportDocument rptDoc = new ReportDocument();
        rptDoc.Load(Server.MapPath("../Reportes/rptEstBitacora01.rpt"));
        rptDoc.SetDataSource(Bitacora);
        rptDoc.SetParameterValue("Ciclo", Ciclo);

        MemoryStream stream = (MemoryStream)rptDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.Excel);
        rptDoc.Close();
        rptDoc.Dispose();

        Response.Clear();
        Response.Buffer = true;
        Response.ContentType = "application/vnd.ms-excel";
        Response.AddHeader("Content-Disposition", "inline; filename=rptEstBitacora01.xls");
        Response.BinaryWrite(stream.ToArray());
        Response.End();
        stream.Close();
        stream.Dispose();
    }
开发者ID:amoras5,项目名称:cb_reinscripcion,代码行数:34,代码来源:Calificaciones.aspx.cs

示例7: VistaPrevia

        public void VistaPrevia(string key)
        {
            try
            {
                ReportDocument objRpt = new ReportDocument();
                DataSet ds = (DataSet)this.GetDataReport(key);

                //string reportPath = Application.StartupPath + "\\Reporte\\co_ordenCompra_rpt.rpt";
                string reportPath = "C:\\Reportes\\CR_Cliente_rpt01.rpt";
                objRpt.Load(reportPath);

                DiskFileDestinationOptions crDiskFileDestinationOption = new DiskFileDestinationOptions();
                PdfRtfWordFormatOptions crFormatTypeOption = new PdfRtfWordFormatOptions();
                ExportOptions crExportOptions = new ExportOptions();

                objRpt.SetDataSource(ds.Tables[0]);
                string strfolder = "C:\\Reporte\\";
                crDiskFileDestinationOption.DiskFileName = strfolder + "Cliente.pdf";

                crExportOptions = objRpt.ExportOptions;
                crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                crExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

                crExportOptions.ExportDestinationOptions = crDiskFileDestinationOption;
                crExportOptions.ExportFormatOptions = crFormatTypeOption;
                crystalReportViewer1.ReportSource = objRpt;
                //objRpt.Export();

            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }
开发者ID:ArquitecturaSoftware,项目名称:texfinadev,代码行数:34,代码来源:FrmCliente_rpt01.cs

示例8: frmReamMoneyPrint_Load

        private void frmReamMoneyPrint_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;

            ReamMoney reamMoney = new ReamMoney();
            reamMoney = reamMoneyService.getReamMoneyByID(rid);

            List<ReamMoneyReport> reamMoneyReports = new List<ReamMoneyReport>();
            ReamMoneyReport reamMoneyReport = new ReamMoneyReport();
            Person p = new Person();
            p = personService.getPersonBypsnCode(reamMoney.person.psnCode);

            reamMoneyReport.fullName = p.psnPreFix + " " + p.psnName + " " + p.psnLastName;
            reamMoneyReport.amount =Convert.ToString(reamMoney.amount);
            reamMoneyReport.reamDate = reamMoney.reamdate;

            reamMoneyReports.Add(reamMoneyReport);

            ReportDocument rp = new ReportDocument();
            string path = Application.StartupPath + @"\report\rptReamMoney.rpt";
            rp.Load(path);
            rp.SetDataSource(reamMoneyReports);

            PV.ReportSource = rp;
        }
开发者ID:marcpiulachs,项目名称:sttproject,代码行数:25,代码来源:frmReamMoneyPrint.cs

示例9: ExportReport

        public ActionResult ExportReport()
        {
            List<Investment> allInvestment = new List<Investment>();

            using (efarmingEntities dc = new efarmingEntities())
            {
                allInvestment = dc.Investments.ToList();
            }

            ReportDocument rd = new ReportDocument();
            rd.Load(Path.Combine(Server.MapPath("~/Reports"), "rpt_InvestmentList.rpt"));
            rd.SetDataSource(allInvestment);

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();

            try
            {
                Stream stream = rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
                stream.Seek(0, SeekOrigin.Begin);
                return File(stream, "application/pdf", "InvestmentList.pdf");
            }
            catch (Exception)
            {

                throw;
            }
        }
开发者ID:arvind-web-developer,项目名称:csharp-projects-CrystalReports,代码行数:29,代码来源:HomeController.cs

示例10: CriaPDF

        private void CriaPDF()
        {
            Hashtable hashtable = (Hashtable)Session["HashAgendaMontadaPublicada"];

            DSCabecalhoAgendaMontadaPublicada cabecalho = new DSCabecalhoAgendaMontadaPublicada();
            cabecalho.Tables.Add((DataTable)hashtable["cabecalho"]);

            DSRelatorioAgendaMontadaPublicada dados = new DSRelatorioAgendaMontadaPublicada();
            dados.Tables.Add((DataTable)hashtable["dados"]);

            ReportDocument repDoc = new ReportDocument();

            repDoc.Load(Server.MapPath("RelatoriosCrystal/CrystalReportViewer_AgendaMontadaPublicada.rpt"));
            repDoc.SetDataSource(dados.Tables[1]);
            repDoc.Subreports["CrystalReportViewer_CabecalhoAgendaMontadaPublicada.rpt"].SetDataSource(cabecalho.Tables[1]);

            System.IO.Stream s = repDoc.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            Response.ClearContent();
            Response.ClearHeaders();
            Response.ContentType = "applicattion/octect-stream";
            Response.AddHeader("Content-Disposition", "attachment;filename=RelatorioDeAgendasMontadasPublicadas.pdf");
            Response.AddHeader("Content-Length", s.Length.ToString());
            Response.BinaryWrite(((System.IO.MemoryStream)s).ToArray());
            Response.End();

            Session.Remove("HashAgendaMontadaPublicada");
        }
开发者ID:vivermais,项目名称:vivermais,代码行数:27,代码来源:RelatorioAgendaMontadaPublicada.aspx.cs

示例11: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                DataTable _dtSaldos = null;
                //Int32 nPrvCod = 0;
                _dtSaldos = (DataTable)Session["dtSaldos"];
                //nPrvCod = Int32.Parse((String)Session["nPrvCod"]);

                if (_dtSaldos != null )
                {
                    if (_dtSaldos.Rows.Count != 0)
                    {
                        ReportDocument rpt = new ReportDocument();
                        rpt.Load(Server.MapPath("rpt/crSaldos.rpt"));
                        rpt.FileName = Server.MapPath("rpt/crSaldos.rpt");
                        rpt.SetDataSource(_dtSaldos);

                        CrystalReportViewer8.ReportSource = rpt;
                        CrystalReportViewer8.ReuseParameterValuesOnRefresh = true;
                    }
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
开发者ID:sestremadoyro,项目名称:Agrocomercio,代码行数:29,代码来源:ImpresionSaldos.aspx.cs

示例12: Page_Load

 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["username"] == null)
     {
         Function.CheckIstimeout();
     }
     else
     {
         if (!IsPostBack)
         {
             SystemlogManager.Addnewslog(Session["username"].ToString());
         }
         //SqlConnection con = new SqlConnection(connstr);
         //con.Open();
         //string sql = "select * from GuZhangSecond";
         //SqlDataAdapter da = new SqlDataAdapter(sql, con);
         string faluid = Request.QueryString["a"].ToString();
         DataTable ds = new DataTable();
         ds = sfm.GetprintFault(faluid);
         //SecondFaultManager sfm = new SecondFaultManager();
         //CrystalReportViewer1.ReportSource = sfm.GetAllSeconFaultBynull();
         ReportDocument doc = new ReportDocument();
         doc.Load(Server.MapPath("../CrystalReport/FauluTable.rpt"));
         doc.SetDataSource(ds);
         CrystalReportViewer1.ReportSource = doc;
     }
     //con.Close();
 }
开发者ID:rontom,项目名称:baozhang_system,代码行数:28,代码来源:print.aspx.cs

示例13: showListeFournisseur

        private void showListeFournisseur()
        {
            try
            {
                SqlDataAdapter dataAdapter = new SqlDataAdapter();

                String sqlCommand = "SELECT * FROM Fournisseur";

                _dataSet = new DataSet();

                dataAdapter.SelectCommand = new SqlCommand(sqlCommand, Program._connection);
                dataAdapter.Fill(_dataSet);

                ReportDocument rapport = new ReportDocument();
                String path = Application.StartupPath + "\\CR_ListeFournisseur.rpt";
                rapport.Load(path);
                rapport.SetDataSource(_dataSet);

                CRV_Rapport.ReportSource = rapport;
                CRV_Rapport.Refresh();

            }
            catch(Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
开发者ID:Yrutan,项目名称:TP_BD_1-2,代码行数:27,代码来源:Form_Rapport.cs

示例14: bindReport

 private void bindReport()
 {
     if (Convert.ToString(Session[Global.SESSION_KEY_CULTURE]) == "ar-AE")
     {
         dt = RL.PrintMaterListEnglish();
     }
     else
     {
         dt = RL.PrintMaterListEnglish();
     }
     if (dt.Rows.Count > 0)
     {
         ReportDocument report = new ReportDocument();
         report.Load(Server.MapPath("..//..//Reports//PrintAllMatter.rpt"));
         report.SetDataSource(dt);
         // report.Refresh();
         //CrystalReportViewer1.ReportSource = report;
         MemoryStream oStream = new MemoryStream(); // using System.IO
         oStream = (MemoryStream)report.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
         Response.Clear(); Response.Buffer = true;
         Response.ContentType = "application/pdf";
         Response.BinaryWrite(oStream.ToArray());
         Response.End();
     }
 }
开发者ID:progressiveinfotech,项目名称:PRO-FY13-18_Habib-al-Mulla,代码行数:25,代码来源:PrintMatter.aspx.cs

示例15: loadData

 void loadData()
 {
     try
     {
         DataSet dataset = new DataSet();
         ReportDocument RepDoc = new ReportDocument();
         string dir = Environment.CurrentDirectory;
         dir = dir + "//CrtGharardad.rpt";
        // RepPath = @"D:\Project\Industrial College\Project1\Source26\Source28\Source25\Source27\Source24\Pazhohesh\Pazhohesh\Report\Crystal\CrtGharardad.rpt";
         RepDoc.Load(dir);
         objDataAdapter.SelectCommand = new SqlCommand();
         objDataAdapter.SelectCommand.Connection = FrmEnter.objConnection;
         objDataAdapter.SelectCommand.Parameters.AddWithValue("@GharardadDate" , FrmFlagProject.year + "%");
         objDataAdapter.SelectCommand.Parameters.AddWithValue("@StartDate", FrmSelectTypeGharardad.year + "%");
         DataTable objLoad = new DataTable();
         objLoad.Clear();
         if (FrmSelectTypeGharardad.GharardadFlag == 1)
         {
             objDataAdapter.SelectCommand.CommandText = "SELECT GharardadID , ProjectID, ProjectTitle, PersonName, PersonFamily, GharardadDate , CreditGharardad from VwGharardadReport where ProjectID in(Select distinct ProjectID from Tbl_PersonRole where GharardadID is not null AND RoleID = 0) AND GharardadDate like @GharardadDate";
             lblTypeGharardad.Text = "لیست طرح های پژوهشی که در سال" + " " + FrmFlagProject.year + " " + "منجر به عقد قرارداد شده اند";
         }
         else if (FrmSelectTypeGharardad.GharardadFlag == 0)
         {
             objDataAdapter.SelectCommand.CommandText = "SELECT GharardadID , ProjectID, ProjectTitle, PersonName, PersonFamily , GharardadDate , CreditGharardad from VwGharardadReport where ProjectID in(Select distinct ProjectID from Tbl_PersonRole where GharardadID is null AND RoleID = 0) AND StartDate like @StartDate";
             lblTypeGharardad.Text = "لیست طرح های پژوهشی که در سال" + " " + FrmSelectTypeGharardad.year + " " +  "منجر به عقد قرارداد نشده اند";
         }
         objDataAdapter.Fill(objLoad);
         RepDoc.SetDataSource(objLoad);
         crystalReportViewer1.ReportSource = RepDoc;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
开发者ID:rad-navid,项目名称:forms-automation,代码行数:35,代码来源:FrmReportViewerGharardad.cs


注:本文中的ReportDocument.SetDataSource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。