水晶报表(推模式)(学习笔记)
vs2008中:
protected void Page_Load(object sender, EventArgs e)
{
//推模式
CrystalReport1 rpt = new CrystalReport1();
rpt.SetDataSource(CommonCode.GetData());
CrystalReportViewer1.ReportSource = rpt;
}
public static class CommonCode
{
public static DataTable GetData()
{
string constr = "Data Source=.;Initial Catalog=db_Test;Integrated Security=True";
using (SqlConnection conn = new SqlConnection(constr))
{
SqlDataAdapter da = new SqlDataAdapter("select * from dbo.T_Orders",conn);
DataSet ds = new DataSet();
da.Fill(ds);
return ds.Tables[0];
}
}
}
补充:综合编程 , 其他综合 ,