cskg0001 发表于 2016-5-31 21:11:18

AR10中页面报表的SQL传递

本帖最后由 Lenka.Guo 于 2016-6-1 09:49 编辑

有没有办法把一个完整的SQL语句传递到页面报表,让这个页面报表使用该SQL语句查询的数据生成报表?

Lenka.Guo 发表于 2016-6-1 09:48:42

Hi,

您是指的是 通过后台代码,为报表添加数据。
可以参考博客:http://blog.gcpowertools.com.cn/post/2013/05/17/ActiveReports-PageReport-RunTime-DataSource.aspx

因为您要通过SQL 语句查询,所以需要修改博客中的GetData 方法,示例如下:
string constr = @"Provider=sqloledb; password=12222222;data source=10.32.2.28;initial catalog=NWind_CHS;user id=sa;";

OleDbConnection conn = new OleDbConnection(constr);

DataTablemyDataTable= new DataTable();

OleDbCommand cmd1 = new OleDbCommand("Select * from 产品", conn);
         OleDbDataAdapter oleAdapter1 = new OleDbDataAdapter(cmd1);
         oleAdapter1.Fill(myDataTable);


args.Data = myDataTable;




页: [1]
查看完整版本: AR10中页面报表的SQL传递