Directory:
First, the solution one: report data access using the push model
Second, the solution two: Record the selected formula run time customization
Iii. Solution Three: Merge parameters into records select formula
----------------------------------
Solution One:
Report data access Usage push model
Developers are required to write code to connect to the database, execute SQL commands to create a recordset or dataset that matches the fields in the report, and pass the object to the report. This method allows you to place the connection share into your application and filter the data before Crystal Reports receives the data.
----------------------------------
Solution Two:
Log selected formula run-time customizations
1. Pass the selected formula through the viewer control
[Visual Basic]
Dim Selectformula as String
Selectformula = "{customer. Sales last year} >" & TextBox1 (). Text
Crystalreportviewer1.selectionformula = Selectformula
[C #]
String Selectformula;
Selectformula = "{customer. Sales last year} >" + TextBox1.Text;
Crystalreportviewer1.selectionformula = Selectformula;
[C + +]
string* Selectformula;
Selectformula->concat
("{customer. Sales last year} >", Textbox1->text);
Crystalreportviewer1->selectionformula = Selectformula;
2, pass the selected formula through the report object
[Visual Basic]
Dim Selectformula as String
Selectformula = "{customer. Sales last year} >" & TextBox1 (). Text
Report.DataDefinition.RecordSelectionFormula = Selectformula
[C #]
String Selectformula;
Selectformula = "{customer. Sales last year} >" + TextBox1.Text;
Report.DataDefinition.RecordSelectionFormula = Selectformula;
[C + +]
string* Selectformula;
Selectformula->concat
("{customer. Sales last year} >", Textbox1->text);
Report->datadefinition->recordselectionformula = Selectformula;
3, refresh the corresponding report by using the following line of code to end this code:
Crystalreportviewer1.refreshreport ()
The formula is updated and the new minimum value (sales for the previous year) is used.
----------------------------------
Solution Three:
Merge parameters into a record select formula
Parameter fields need not be placed in a report to be used in a record or group selection formula. Create a parameter field, and then enter it into the formula as if you were inserting other fields.
Record selection with a formula
To reduce the amount of data transferred from the database server and improve performance, merge the parameter fields directly into the record selection formula.
The following record selects the formula to bring the user into the sales quota and only displays all customers with sales exceeding the sales quota last year.
{customer. Sales last year} > {? SalesQuota}
Developers are required to write code to pass parameter values at run time.
The article is reproduced from the network base: http://www.xrss.cn/Dev/DotNet/200852419730.Html