那也叫动态呀,根本就不通用呀。
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;
using System.Data;
using System.IO;
namespace WindowsApplication1
{
class ReportClass
{
public DataSet ReportData;
public FileStream ReportStream;
public string TableName;
public string CreateFileName;
public ReportClass()
{
ReportData = new DataSet();
CreateFileName = @"c:\TempRrport.rdlc";
}
public void GetStream(string ReportFile)
{
ReportStream = new FileStream(ReportFile, FileMode.Open, FileAccess.Read);
}
public void ShowReport()
{
Form ReportFrom = new Form();
ReportFrom.Text = "报表预览...";
ReportFrom.WindowState = FormWindowState.Maximized;
ReportViewer myReportViewer = new ReportViewer();
myReportViewer.Dock = DockStyle.Fill;
ReportFrom.Controls.Add(myReportViewer);