Data sources and Parameters problem!

edited July 2009 in FastReport .NET
Hi!

I have three problems when i design a statistics form, i need get every data source's row data to fill in textbox.

1-How can i get every data source's row data ?
i had try to used code as follow, but it's not work:
TableDataSource ds = Report.GetDataSource("EDUSTUSING") as TableDataSource;
Report.SetParameterValue("A1", ds.Table.Rows[0].ToString());

2-When use FAST REPORT parameters. Can i declare and use it in code? not pre-declare in "Data-Parameters"

3-How cloud i adjust design "Page", the page always too small, so i must use bar to find appropriate position

Thank you!

Comments

  • edited 1:47AM
    Hello,

    1) Do you mean "Text" object? Just put a text object on the Data band and set databand's source to your datasource.
    2) You can do it in your application's code.

    report1.SetParameterValue("MyParam", 10)
    will create a parameter with "MyParam" name if it does not exist.

    3) If you want to adjust page size/orientation/margins, use "File|Page Setup..." menu.
  • edited 1:47AM
    Sorry!

    For 1's problem, i mean when i set DATA SOURCE alredy , but i want to show the DATA with CODE-like FOR() recursion to get each DATA onto textbox, how can i do this function?

    For 3's problem, i want to adjust design page when i design report, not set page size when print.

    Thank you!
  • edited 1:47AM
    1) Use the following code:
          // get the data source by its name
          DataSourceBase rowData = Report.GetDataSource("Products");
          // init the data source
          rowData.Init();
          
          // now enumerate the data source
          while (rowData.HasMoreRows)
          {
            textBox1.Text += ((String)Report.GetColumnValue("Products.ProductName"));
            // go next data source row
            rowData.Next();
          }
    

    the "((String)Report.GetColumnValue("Products.ProductName"))" part can be added by dragging a data column from the "Data" window to the script.

    3) To adjust a page zoom, use the zoom controls in the right-bottom edge of the designer.
  • edited 1:47AM
    Thank You!

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.