我是水晶报道的新手。有没有办法添加我对水晶报告数据源的数据表?
我已将此数据表用于datagridview,是否可以将该数据表用作水晶报表的来源?
DataAccess datax = new DataAccess();
DataSet ds = new DataSet("dataset");
DataTable dt = new DataTable();
DataColumn property, minimum, result, maximum, remarks;
public ReportingForm(string resin_type, string resin_code, string batch_num)
{
InitializeComponent();
datax.initialize();
AnalysisReport analysis_rep = new AnalysisReport();
property = new DataColumn();
minimum = new DataColumn();
result = new DataColumn();
maximum = new DataColumn();
remarks = new DataColumn();
property.ColumnName = "Property";
minimum.ColumnName = "Minimum";
result.ColumnName = "Result";
maximum.ColumnName = "Maximum";
dt.Columns.AddRange(new DataColumn[] { property, minimum, result, maximum, remarks });
initialize_data(resin_type, resin_code, batch_num); //sets the rows
ds.Tables.Add(dt);
analysis_rep.SetDataSource(ds.Tables[0]);
crpt.ReportSource = analysis_rep;
}
行analysis_rep.SetDataSource(ds.Tables[0]);
中的会抛出错误,显示“报告没有表格”
我还尝试了analysis_rep.SetDataSource(dt);
,我尝试将数据源设置为数据表,结果相同。
ds.Tables.Count = 1