开发者

Reporting of VS 2010 and my issues

I make a WinForms app and I use ReportViewer on my form and I design a report (.rdlc) for it. In my report I select my table and stored procedure and I define the parameter for my stored procedure, and in form load event of my form I write :

private void Form1_Load(object sender, EventArgs e)
{
     // TODO: This line of code loads data into the 'testoDataSet.Table2' table. You can move, or remove it, as needed.
     this.Table2TableAdapter.Fill(this.testoDataSet.Table2);

     ReportParameter pa = new ReportParameter("Name", "abc");
     ReportParameter pa1 = new ReportParameter("Family", "xyz");

     reportViewer1.LocalReport.SetParameters(new ReportParameter[] { pa, pa1 });
     reportViewer1.LocalRepo开发者_如何学JAVArt.Refresh();

     this.reportViewer1.RefreshReport();
 }

but when I run my app all records showed on my report viewer but my select query is:

select * 
from User 
where Name = 'abc' and Family = 'xyz';

What is wrong??


You need to be passing the parameters in an overloaded TableAdapter.Fill

See here

Also a guide here for WebForms but should be similar.


it solved:

this.Table2TableAdapter.FillByNameAndFamily(this.testoDataSet.Table2, "abc", "xyz");
            this.reportViewer1.RefreshReport();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜