我有两个问题:
1)我有一个分配给文本框的“P2”参数,但我不知道是否有必要为表达式中的参数定义数据类型?如果是,如何获得
2)当我运行报告进行查询时。报告给了我一个错误Parameter P2 is missing a value
。无隐藏
提前致谢
private void RbtnSearch_Click(object sender, EventArgs e)
{
ModelRealEstate.DB_RealEstateEntities objdb = new ModelRealEstate.DB_RealEstateEntities();
var rows = objdb.Tbl_Property
.Where(x => x.Adress.Contains(mtxbxRprt.Text))
.ToList();
reportViewer1.LocalReport.ReportPath = ("Report1.rdlc");
reportViewer1.LocalReport.SetParameters(
new Microsoft.Reporting.WinForms.ReportParameter(
"P2", mtxbxRprt.Text));
reportViewer1.LocalReport.DataSources.Add(
new Microsoft.Reporting.WinForms.ReportDataSource(
"DataSet1", rows));
reportViewer1.RefreshReport();
}