String SQL = "Select * from Orders ";
String DBConfig_ SQL = @ "Data Source = WAN-9013A0BB35C \ SQL2005; Initial Catalog = Northwind; User ID = sa ";
DataSet ds = new DataSet ();
SqlConnection sqlCon = new SqlConnection (DBConfig_ SQL );
SqlCommand sqlCmd = new SqlCommand (SQL, sqlCon );
SqlDataAdapter sqglad = new SqlDataAdapter ();
Sqglad. SelectCommand = sqlCmd;
Sqglad. Fill (ds, "Orders ");
CrystalReportSource1.ReportDocument. Load (Server. MapPath ("CrystalReport. rpt "));
// Note that the name of the table in Dataset must be specified here. Otherwise, the system prompts "the report you requested requires more information ."
CrystalReportSource1.ReportDocument. SetDataSource (ds. Tables ["Orders"]);
//{?} You do not need to assign values to parameters in, even if a value is assigned.
CrystalReportSource1.ReportDocument. ParameterFields ["Parm"]. CurrentValues. AddValue ("1234567 ");
CrystalReportSource1.ReportDocument. ParameterFields ["Title"]. CurrentValues. AddValue ("sample report in Push mode! ");
CrystalReportSource1.DataBind ();
CrystalReportViewer1.ReportSource = CrystalReportSource1;
CrystalReportViewer1.DataBind ();
Summary:
Database Connection
Fill dataset
Report viewer obtains ReportDocument objects and extracts data from reports.
Pass dataset data to the Report Engine
Crystal Report registration code
Crystal Report registration code:
Password: AAP5GKS0000GHE100UM
Registration Code 6078043616
6110167826
Aap50gs1_gsg80038
Your registration number is 6275350665
Your new key is AAP5GKS0000GBB100C9
This is the 9.2 license key:
AVS50-81SG00S-G61002U 1236731231
9999999991
0019250903
0004400007
1112411119