. NET common tricks _fastreport print dataset settings

Source: Internet
Author: User

Private voidBtnprint_click (Objectsender, EventArgs e) {   //print master and slave table data   stringFile = Application.startuppath@"\masterdetail.frx"; Rptmasterdetail.load (file);//To load a report template fileDataSet DS= DAL. Getmasterdetaildata ();//Fetching report DataRptmasterdetail.registerdata (ds. tables[0],"Tb_so");//registering a data source, primary tableRptmasterdetail.registerdata (ds. tables[1],"Tb_sos");//registering a data source from a table//    //registering a DataSet directly is OK, but you must specify a table name for Dataset.tables! //Fastreport is a DataTable object that is followed by a table name. //    //Rptmasterdetail.registerdata (DS); //       //bind data Source to Databand (primary table data)Databand Masterband = Rptmasterdetail.findobject ("Data1") asDataband; Masterband.datasource= Rptmasterdetail.getdatasource ("Tb_so");//Main Table//bind a data source to Databand (detail data)Databand Detailband = Rptmasterdetail.findobject ("Data2") asDataband; Detailband.datasource= Rptmasterdetail.getdatasource ("Tb_sos");//Schedule//Important!! Set the primary foreign key relationship for the schedule! Detailband.relation =NewRelation (); DetailBand.Relation.ParentColumns=New string[] {"SONO" }; DetailBand.Relation.ParentDataSource= Rptmasterdetail.getdatasource ("Tb_so");//Main TableDetailBand.Relation.ChildColumns =New string[] {"SONO" }; DetailBand.Relation.ChildDataSource= Rptmasterdetail.getdatasource ("Tb_sos");//Schedule//ready to work, Show report preview formRptmasterdetail.prepare (); Rptmasterdetail.showprepared (true, This); }  

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.