How To Filter Data In C# Code

Hi
I am a developer and i have use FastReport.Net for my Reports.
I am new user for FastReport.Net and I have a problem.
Please help me that how can I simulate Crystal Reports SelectionFormula in FastReport.Net?
I cant use the Parameter, because my formula is like "SELECT * FROM Table1 WHERE Field1 BETWEEN @FromV AND @ToV AND Field2 IN (1,2,3,4,...)"
Please Help me
Best Regards

Comments

  • pinbotpinbot Texas
    edited 9:02PM

    It's fairly easy.

    Create your sql like this in your c# code:

    string sql="select xxx from yyy where ....";

    then replace the SQL Select Command in the FastReport table data source object:


    (this is from working code):

    FastReport.Utils.Config.WebMode = true;
    FastReport.Report Rpt = new FastReport.Report();
    Rpt.Load(this.Page.Server.MapPath("../App_Data/MyFastReport.Frx"));
    str sql="(my sql that references parameters, etc)"


    FastReport.Data.TableDataSource tds = (FastReport.Data.TableDataSource) Rpt.GetDataSource("VendorGuideSearch");
    tds.SelectCommand = sql;

    Rpt.SetParameterValue("MapIds", MapIds);
    Rpt.Prepare();
    FastReport.Export.Pdf.PDFExport export = new FastReport.Export.Pdf.PDFExport();
    export.PrintOptimized = false;
    export.OpenAfterExport = false;

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.