如何将一个表填充到水晶报表中?
在数据集中拖入一个DataTable命名为“mytable”,如何将一个填充并在水晶报表中显示?在form1中这样写代码,不知道为何报表不显示,SQL测试是有数据了!
namespace InformationSystem.Report
{
public partial class Form1 : Form
{
SqlConnection conn = new SqlConnection("server=127.0.0.1;database=InformationSystem_2012;uid=sa;pwd=qjw159;");
DataSet1 myDate = new DataSet1();
SqlDataAdapter da;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
da = new SqlDataAdapter("select * from tb_AgrRecord",conn);
da.Fill(myDate, "mytable");
CrystalReport2 cr = new CrystalReport2();
cr.SetDataSource(myDate);
crystalReportViewer1.ReportSource = cr;
}
}
}
补充:.NET技术 , C#