rdlc的打印问题
我将使用 *.rdlc 在 wpf 中创建打印页面。 为此,我创建了一个类(以下是代码)。 我将类绑定到报告,但是当我运行程序时,出现以下消息:
尚未为数据源“dataset1”提供数据源即时信息
class rpt_insurance
{
private string _insurance;
private int _count_print;
private int _sum_tariff;
private int _lot_org;
public string insurance
{
get { return _insurance; }
set { _insurance = value; }
}
public int count_print
{
get { return _count_print; }
set { _count_print = value; }
}
public int sum_tariff
{
get { return _sum_tariff; }
set { _sum_tariff = value; }
}
public int lot_org
{
get { return _lot_org; }
set { _lot_org = value; }
}
public DataTable report_insurance(string from_date,string to_date)
{
using (doctorEntities de = new doctorEntities())
{
var print = (from Table_infobase_print tip in de.Table_infobase_print
where tip.Print_date.CompareTo(from_date) > 0 && tip.Print_date.CompareTo(to_date) < 0
select tip).ToList();
var insurance = (from Table_insurance_org tio in de.Table_insurance_org
select tio).ToList();
List<rpt_insurance> lri = new List<rpt_insurance>();
foreach (var insurance_row in insurance)
{
rpt_insurance ri = new rpt_insurance();
int number = 0;
foreach (var print_row in print)
{
if(print_row.insurance_org==insurance_row.org_name)
{
number++;
ri.insurance = print_row.insurance_org;
ri.count_print = number;
ri.sum_tariff = ri.sum_tariff + print_row.sum_tariff;
ri.lot_org=lot_org+(print_row.sum_tariff-print_row.sum_lot_patient);
}
}
if (ri.insurance != null)
{
lri.Add(ri);
}
}
DataTable dt = new DataTable();
dt = new DataTable();
dt.Columns.Add("cinsurance");
dt.Columns.Add("ccount_print");
dt.Columns.Add("csum_tariff");
dt.Columns.Add("clot_org");
for (int i = 0; i < lri.Count; i++)
{
DataRow dr = dt.NewRow();
dr["cinsurance"] = lri[i].insurance;
dr["ccount_print"] = lri[i].count_print;
dr["csum_tariff"] = lri[i].sum_tariff;
dr["clot_org"] = lri[i].lot_org;
dt.Rows.Add(dr);
}
return dt;
}
}
}
I am going to create print page in wpf with *.rdlc.
For this , i create a class(following is this codes).
I bind the class to report but when i run the program , following message occurs :
A data source instant has not been supplied for data source 'dataset1'
class rpt_insurance
{
private string _insurance;
private int _count_print;
private int _sum_tariff;
private int _lot_org;
public string insurance
{
get { return _insurance; }
set { _insurance = value; }
}
public int count_print
{
get { return _count_print; }
set { _count_print = value; }
}
public int sum_tariff
{
get { return _sum_tariff; }
set { _sum_tariff = value; }
}
public int lot_org
{
get { return _lot_org; }
set { _lot_org = value; }
}
public DataTable report_insurance(string from_date,string to_date)
{
using (doctorEntities de = new doctorEntities())
{
var print = (from Table_infobase_print tip in de.Table_infobase_print
where tip.Print_date.CompareTo(from_date) > 0 && tip.Print_date.CompareTo(to_date) < 0
select tip).ToList();
var insurance = (from Table_insurance_org tio in de.Table_insurance_org
select tio).ToList();
List<rpt_insurance> lri = new List<rpt_insurance>();
foreach (var insurance_row in insurance)
{
rpt_insurance ri = new rpt_insurance();
int number = 0;
foreach (var print_row in print)
{
if(print_row.insurance_org==insurance_row.org_name)
{
number++;
ri.insurance = print_row.insurance_org;
ri.count_print = number;
ri.sum_tariff = ri.sum_tariff + print_row.sum_tariff;
ri.lot_org=lot_org+(print_row.sum_tariff-print_row.sum_lot_patient);
}
}
if (ri.insurance != null)
{
lri.Add(ri);
}
}
DataTable dt = new DataTable();
dt = new DataTable();
dt.Columns.Add("cinsurance");
dt.Columns.Add("ccount_print");
dt.Columns.Add("csum_tariff");
dt.Columns.Add("clot_org");
for (int i = 0; i < lri.Count; i++)
{
DataRow dr = dt.NewRow();
dr["cinsurance"] = lri[i].insurance;
dr["ccount_print"] = lri[i].count_print;
dr["csum_tariff"] = lri[i].sum_tariff;
dr["clot_org"] = lri[i].lot_org;
dt.Rows.Add(dr);
}
return dt;
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要向报告提供数据集。类似于:
编辑:根据您的评论
您确实无法绕过调用数据检索方法并将该数据发送到报告的需要。
You need to supply the dataset to your report. Something like:
Edit: based on your comment
You really can't get around the need to call your data retrieval method AND send that data through to the report.