C # Preliminary Experience Fastreport report

Source: Internet
Author: User
The original program used Word and Excel to do some export data and print operations, but running for some time found that there are always some users of the computer installed on the office some problems, but also need to reinstall the adjustment caused some additional maintenance work.

This is done by simply trying to use fastreport instead of office, generating some of the data that needs to be exported as a report, and saving it as an Excel format, so you can reduce unnecessary hassles.

In the program to the connection information from the report, to avoid the report file is not secure, in addition, this connection information can be done separately in the configuration file.




Using system;using system.collections.generic;using system.componentmodel;using system.data;using System.Drawing; Using system.text;using system.windows.forms;using system.data.sqlclient;namespace test fastreport{public partial class         Form1:form {private DataSet data;        Public Form1 () {InitializeComponent (); private void Button1_Click (object sender, EventArgs e) {string constr = "server= ' 127.0.0.1 '; in Itial Catalog=waimaojinkou; uid= ' sa '; Pwd= ' 12345 ';            Max Pool size=512; ";                try {SqlConnection con = new SqlConnection (CONSTR); Con.                Open ();                SqlCommand sqlcmd = new SqlCommand (); sqlcmd.                Connection = con;                Sqlcmd.commandtext = @ "SELECT * FROM [Event]";                SqlDataAdapter SDA = new SqlDataAdapter (sqlcmd);                data = new DataSet (); Sda.                Fill (data); Con.                Close (); Sda. DisPose (); } catch (Exception err) {MessageBox.Show (err.            StackTrace);                try {fastreport.report report = new Fastreport.report ();                string filename = Application.startuppath + @ "\frxreport\qualityevent.frx";                string filename = @ "D:\qualityEvent.frx"; Report.                Load (filename); Report.                Registerdata (data); Report. Getdatasource (data. Tables[0]. TableName).                Enabled = true; Report.            Show (); } catch (Exception err) {MessageBox.Show (err.            Message); }        }    }}

Tried a few times, only used. Net4.0, Fastreport will be recognized, so the development of the project also needs to be re-set, reinstall. NET4.0 Framework Package.

Related Article

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.