Open the Default.aspx page in Design mode.
Navigate to the Reporting section in the Toolbox and find the
CrystalReportPartsViewer control. Drag this control onto the Default.aspx
Double click on the web page to view the code behind.
Add the following using statements.
Add the following code to the Page_Load event.
ReportDocument customersReport = new ReportDocument();
string reportPath = Server.MapPath("Sales.rpt");
CrystalReportPartsViewer1.ReportSource = customersReport;
Add the SetTableLocation method.
private void SetTableLocation(Tables tables)
ConnectionInfo connectionInfo = new ConnectionInfo();
connectionInfo.ServerName = @"YOURSERVER";
connectionInfo.DatabaseName = "AdventureWorks";
connectionInfo.UserID = "YOURSQLLOGIN";
connectionInfo.Password = "YOURPASSWORD";
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
TableLogOnInfo tableLogOnInfo = table.LogOnInfo;
tableLogOnInfo.ConnectionInfo = connectionInfo;
Be sure to change the ServerName, UserID, and Password to your settings.
Click the Run button to start the project. Make sure the Default.aspx
page is set as the startup page. You should see the following page.
Click on the $82,425,341.28 next to the United States. You should see
the following page.
displays all the states within the United States. The Next link will allow you
to scroll through the list. If you wanted to display more than 10 at a time
you can change the BatchSize property of the PartsViewer control.
on the $308,827.13 next to Idaho. This will display the cities within Idaho
with an order. You should see the following page.
on the $9,254.26 next to Sandpoint. This will drill into the individual detail
records that make up this total.