C#如何调用Fastreport

来源:百度知道 编辑:UC知道 时间:2024/04/29 05:14:59
我用的是C# 语言..用fastreport 做一个报表,需要根据后台选中的数据库表中的ID来显示具体的信息
现在我如何 把后台根据条件查询到的数据集传给
fastreport文件进行绑定.
我做的是B/S结构的 要连接到fastreport这个工具

引用:FastReport.dll,FastReport.Bars.dll,FastReport.Editor.dll
设计好**.frx 文件
代码:
DataSet FDataSet = new DataSet();
DataTable table = new DataTable();
table.TableName = "Items";
FDataSet.Tables.Add(table);
table.Columns.Add("id", typeof(int));
table.Columns.Add("aaa", typeof(string));
table.Rows.Add(0,"ab");
table.Rows.Add(1,"abc");
FastReport.Report report1 = new FastReport.Report();
try
{
// load the existing report
report1.Load("***.frx");
// register the dataset
report1.RegisterData(FDataSet);
report1.GetDataSource("Items").Enabled = true;
// run the report
report1.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
// free resources used by report
report1.Dispose();
}

你给的分有点少呀,