C# Crystal Reports - Date to Date

The following program describes how to generate a Date to Date report from Crystal Reports in C#

All C# Crystal Reports Tutorial in this website is based on the following database - crystaldb. So before you begin this section , please take a look at the database structure of crystaldb - Click Here C# crystaldb

Here we have three tables selected for report (ordermaster , orderdetails and product ) and we are making the formula like , select all records from the tables whose order date is between fromDate parameter and toDate paramater . For doing this you have to select from date as Ordermaster.orderdate, to date as Ordermaster.orderdate , comparison operators , boolean operator (AND) and date parameters fromdate and todate fields from selection list of Formula Editor and make the formula.

The following picture shows how to select the fields from formula editor and make the formula. Double click each field then it will automatically selected .

After the creation of selection formula you can close that screen .

Now the designing part is over and the next step is to call the Crystal Reports in C# and view it in Crystal Reports Viewer control .

Select the default form (Form1.cs) you created in CSharp and drag two Textboxs (from date entry and to date entry) , a button and CrystalReportViewer control to your form.

cryRpt.Load(PUT CRYSTAL REPORT PATH HERE\\CrystalReport1.rpt");
The Crystal Reports file path in your project files location, there you can see CrystalReport1.rpt . So give the full path name of Crystal Reports file like c:\projects\crystalreports\CrystalReport1.rpt