http://wenku.baidu.com/link?url=LBc6dCvPhNj4XjlHEqriWI8wEW_LOplqNi8lhBIIr3jhEpatWwWNWoeowmh_NoNi2A0rY-yEdcgd-K1pvYhP44g2GDeHwvaZkbkfO7A2kX7
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports.Engine;
using System.Data;
using System.Data.SqlClient;
namespace Web水晶
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//CrystalReportViewer1.Visible = false;
//if (!Page.IsPostBack)
//{
// this.Page.ClientScript.RegisterStartupScript(this.GetType(),"","<script>alert('欢迎')</script>");
//}
}
//显示所有报表信息
protected void Button1_Click(object sender, EventArgs e)
{
ReportDocument optDoc = new ReportDocument();
optDoc.Load(Server.MapPath("\CrystalReport1.rpt"));
optDoc.SetDataSource(CommonCodes.GetcheckData());//来自DataSet数据集
CrystalReportViewer1.ReportSource = optDoc;
CrystalReportViewer1.Visible = true;
}
}
}