Israel Mfwamba

Israel Mfwamba

  • NA
  • 20
  • 25.8k

Print preview data filtered in crystal report

Jan 7 2012 9:30 AM
Hi!

I have a question but I would like to put some Delphi's codes maybe to understand very well. Even we are not in Delphi's forum here. I Apologise!
First my target is from a button to make a filter for some datas even all this datas filtered can be displayed on my dbgrid for example. But Its should be also displayed on my Crystal report page print preview (this is the matter I have).

In delphi, I used this for example:

//I filter data
myTable.Filter:= 'name=' +quotedstr(edit1.Text);
myTable.Filtered:= true;

//later on my print preview appear
QuickReport1.Preview;

Now, have a look on what I did on C#. But doesnt work:

private void Imprimir_Click(object sender, EventArgs e)
  {
 
  ReportDocument cryRpt = new ReportDocument();
 cryRpt.Load("C:/Luna_Agua_CS/Luna_Agua/Resources/CRFacturacao.rpt", "select * from facturacao ");
  crystalReportViewer2.ReportSource = cryRpt;
  crystalReportViewer2.Refresh();
 
  }

Answers (7)