ConnectionString

etedalietedali Isfahan
edited 7:01PM in FastReport .NET
Hi,

I have a report prepared, at all stages of construction have done it with the wizard.
But the software on any database system to address differents Connection, I have a ConnectionString in my program files to load before I Report to FastReport for work I wrote the following code:
private void button1_Click(object sender, EventArgs e)
        {
            using (Report rpt = new Report())
            {
                rpt.Load("ReportTest.frx");
                rpt.RegisterData(Person.GetPersonMember(), "Person");
                rpt.GetDataSource("Person").Enabled = true;
                rpt.SetParameterValue("MyParameter", DbConnection.ConnectionString);
                rpt.Show();
            }
        }

But it shows only the first row data in my database? What do I do for solving this problem?
I need a code for a place exactly the part of the wizard ,that I double click on "Data band" and DataSource selection!

Comments

  • edited 7:01PM
    Hello,

    Looks like your databand is not connected to a datasource. You may do it in code:

    ...
    rpt.GetDataSource("Person").Enabled = true;
    (rpt.FindObject("Data1") as DataBand).DataSource = rpt.GetDataSource("Person");
    ...
  • etedalietedali Isfahan
    edited 7:01PM
    Thank you.
    My problem was solved.

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.