The application of Fastreport in asp.net

Source: Internet
Author: User

1. Add references to FastReport.dll and FastReport.Web.dll below the demo folder

2. Add using Fastreport;

Using Fastreport.web;

3. Drag fastreport to the page on the Web page, Design view

4. Add Webreport1_startreport event for Fastreport

<summary>
Get the data
</summary>
<returns></returns>
Public DataSet GetData ()
{
String con = configurationmanager.connectionstrings["con"]. ConnectionString;
SqlConnection connection = new SqlConnection (Con);
SqlCommand command = new SqlCommand ("Select * from Manager", connection);
SqlDataAdapter SDA = new SqlDataAdapter (command);
DataSet ds=new DataSet ();
DataTable managerdata = new DataTable ();
Managerdata.tablename = "Manager";
Sda. Fill (Managerdata);
Ds. Tables.add (Managerdata);
DataTable Payrecord = new DataTable ();
Payrecord. TableName = "Payrecord";
SqlCommand Command1 = new SqlCommand ("SELECT * from Payrecord", connection);
SqlDataAdapter sda1 = new SqlDataAdapter (Command1);
Sda1. Fill (Payrecord);
Ds. Tables.add (Payrecord);
return DS;
}

protected void Webreport1_startreport (object sender, EventArgs e)
{
Fastreport.report-this. Webreport1.report;
. Load (Server.MapPath ("\\ReportTemplate\\demo.frx"));//Load Template
DataSet Ds=this.getdata ();
. Registerdata (DS);//Registration data
}

5. Add Table2_manualbuild event for table

            private void Table2_manualbuild (object sender, EventArgs e)
    {
      datasourcebase source= Report.getdatasource (&quot; manager&quot;);
      Source. Init ();
      table2.printrow (0);
      table2.printcolumns ();
      while source. Hasmorerows)
      {
        table2.printrow (1 );
        table2.printcolumns ();
        Source. Next ();
     }
   } Experience New Blogs

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.