예제 #1
0
 public rpt_Pedidos(int PedidosId)
 {
     InitializeComponent();
     DevExpress.DataAccess.Sql.QueryParameter queryParameter1 = new DevExpress.DataAccess.Sql.QueryParameter();
     queryParameter1.Name      = "@PedidosId";
     queryParameter1.Type      = typeof(int);
     queryParameter1.ValueInfo = Convert.ToString(PedidosId);
     sqlDataSource1.Queries[0].Parameters.Clear();
     sqlDataSource1.Queries[1].Parameters.Clear();
     sqlDataSource1.Queries[0].Parameters.Add(queryParameter1);
     sqlDataSource1.Queries[1].Parameters.Add(queryParameter1);
 }
        private void button1_Click(object sender, EventArgs e)
        {
            XtraReport1 report = new XtraReport1();

            report.Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter()
            {
                Name = "CatID", Type = typeof(Int32), Value = 2, Description = "CategoryID"
            });

            SqlDataSource ds = report.DataSource as SqlDataSource;
            SelectQuery   sq = ds.Queries[0] as SelectQuery;

            DevExpress.DataAccess.Sql.QueryParameter queryParameter1 = new DevExpress.DataAccess.Sql.QueryParameter();
            queryParameter1.Name  = "p1";
            queryParameter1.Type  = typeof(DevExpress.DataAccess.Expression);
            queryParameter1.Value = new DevExpress.DataAccess.Expression("[Parameters.CatID]");
            sq.Parameters.Add(queryParameter1);
            sq.FilterString = "CategoryID = ?p1";

            ReportPrintTool printTool = new ReportPrintTool(report);

            printTool.ShowPreviewDialog();
        }
예제 #3
0
        void GenerateVendorReport()
        {
            Rpt_Pembekal report = new Rpt_Pembekal();

            DevExpress.DataAccess.Sql.SqlDataSource ds = report.DataSource as DevExpress.DataAccess.Sql.SqlDataSource;
            TableQuery tq = ds.Queries[0] as TableQuery;

            if (Session["apsu_lname"] != null)
            {
                report.Parameters.Add(new DevExpress.XtraReports.Parameters.Parameter() { Name = "apsu_lname", Type = typeof(String), Value = "%" + Session["apsu_lname"].ToString() + "%", Description = "apsu_lname" });
                DevExpress.DataAccess.Sql.QueryParameter queryParameter1 = new DevExpress.DataAccess.Sql.QueryParameter();
                queryParameter1.Name = "p1";
                queryParameter1.Type = typeof(DevExpress.DataAccess.Expression);
                queryParameter1.Value = new DevExpress.DataAccess.Expression("[Parameters.apsu_lname]");
                tq.Parameters.Add(queryParameter1);
                tq.FilterString = "apsu_lname LIKE ?p1";
                report.Parameters["apsu_lname"].Visible = false;
            }

            report.RequestParameters = false;
            DocumentViewer.Report = report;
        }