问题
I have never created any report in VS, now i am facing problem in adding reference to my project. Can any one tell me the basics of Report Generation and How to add reference to our project?
回答1:
The purpose of report generation is to take data from a source such as a database, XML stream or a spreadsheet, and use it to produce a document in a format which satisfies a particular human readership.
Please refer ComponentOne HelpCentral for Active Reports for topics to get started with ActiveReports.
Features of Report Generation with c# .NET:
Multiple Report Types to Fit Your Reporting Needs: Fixed Page Layout provides developers with a new way of creating reports where layout is the primary focus. Great for creating invoices, prospectus reports, forms, or other highly structured reports. Continuous Page Layout makes it easy to create reports using tables, crosstabs, charts, and other data regions with flexible layouts.
Data Visualization: This include simple listing or groups with keep-together control, master-detail reports, sub-reports, horizontal and vertical multi-column reports, address labels and badges, or richly formatted letters with mail merge support. Simple and lightweight report controls allow you to easily create dazzling reports.
Data Binding .NET data sources allow you to connect to any of the standard databases, plus .NET in-memory objects and collections. In addition, the unbound data mode opens up the report to data from anywhere, in any form. If your application can access it, so can the report engine.
Visual Studio Integrated Design Time Support
Support for Migration from Other Reporting Tools
Global Options and Localization Support
Basic Steps in Report Generation with Active Reports:
This walkthrough is split into the following activities:
To add an ActiveReport to the Visual Studio project
- Create a new Visual Studio project.
- From the Project menu, select Add New Item.
- In the Add New Item dialog that appears, select ActiveReports 8 Page Report and in the Name field, rename the file as rptMasterDetail.
- Click the Add button to open a new fixed page report in the designer.
To connect the report to a data source
- In the Report Explorer, right-click the Data Sources node and select the Add Data Source option or select Data Source from the Add button.
- In the Report Data Source Dialog that appears, select the General page and in the Name field, enter a name like ReportData.
- On this page, create a connection to the Reels database. See Connect to a Data Source for information on connecting to a data source.
To add a dataset
- In the Report Explorer, right-click the data source node and select the Add Data Set option or select Data Set from the Add button.
- In the DataSet Dialog that appears, select the General page and enter the name of the dataset as CustomerOrders. This name appears as a child node to the data source icon in the Report Explorer.
On the Query page of this dialog, in the Query field enter the following SQL query.
SELECT CustomerID, Title, LastName, Quantity, Price, [Quantity]*[Price] AS Total FROM CustomerOrders WHERE CustomerID < 1010
Click the Validate DataSet icon at the top right hand corner above the Query box to validate the query.
- Click OK to close the dialog. Your data set and queried fields appear as nodes in the Report Explorer.
4.Create a layout for the report
5.To view the report
- Click the preview tab to view the report at design time. or
- Open the report in the Viewer. See Using the Viewer for further information.
To add a reference in Visual C#
- In Solution Explorer, right-click the project node and click Add Reference.
- In the Add Reference dialog box, select the tab indicating the type of component you want to reference.
- Select the components you want to reference, and then click OK.
来源:https://stackoverflow.com/questions/23652426/how-to-create-a-report-using-c-sharp-with-active-reports