水晶报表PUSH模式

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data;
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports.Engine;

namespace TestCrossTab
{
    public partial class _Default : System.Web.UI.Page
    {
        SalesReport salesReport = new SalesReport();
        protected void Page_Load(object sender, EventArgs e)
        {
            string connStr = @"Data Source=.\SQLEXPRESS;AttachDbFilename=D:\其他资料\DevExpress\TestCrossTab\TestCrossTab\App_Data\PUBS.MDF;Integrated Security=True;Connect Timeout=30;User Instance=True";

            SqlConnection con = new SqlConnection(connStr);
            con.Open();
            string sql = @"select * from sales";
            SqlDataAdapter sda = new SqlDataAdapter(sql, con);
            DataSetPush ds = new DataSetPush();//自己建的数据集
            sda.Fill(ds, "sales");

            salesReport.SetDataSource(ds);
            CrystalReportViewer1.ReportSource = salesReport;
        }
    }
}

你可能感兴趣的:(水晶报表PUSH模式)