using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using Microsoft.Reporting.WebForms;
using Microsoft.ApplicationBlocks.Data;
public partial class biao : System.Web.UI.Page
{
public string thisConnectionString = ConfigurationManager.ConnectionStrings[ "testConnectionString"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection(thisConnectionString);
conn.Open();
SqlCommand command = new SqlCommand("select * from ceshi", conn);
SqlDataAdapter da = new SqlDataAdapter(command);
DataSet ds = new DataSet();
da.Fill(ds);
//为报表浏览器指定报表文件
ReportViewer1.LocalReport.ReportEmbeddedResource = "report.Report1.rdlc";
//显示报表
ReportViewer1.LocalReport.ReportPath = "Report1.rdlc";
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1_ceshi", ds.Tables[0]));
ReportViewer1.LocalReport.Refresh();
//ReportViewer1.RefreshReport();
}
}