您好,C1Report提供了自定义数据源,如下代码,加载模板再绑定数据源:
- private void CreateReport(string strSelect, string strConn)
- {
-
- // fill a DataSet object
- OleDbDataAdapter da;
- da = new OleDbDataAdapter(strSelect, strConn);
- DataSet DataSet ds = new DataSet();
- da.Fill(ds);
- // get the DataTable object
- DataTable dt = ds.Tables[0];
- // load report
- c1r.Load("RepDef.xml", "My Report");
- // render report
- c1r.DataSource.Recordset = ds.Tables[0];
- c1ppv.Document = c1r;
-
- }
复制代码 |