Asp.net| Crystal Report
The summary is as follows:
1. The first step is to add a new item CrystalReport1
2. Right-click on the Crystalreport1.rpt face page: "Database" à "Add/Remove Database" appears in the following dialog box:
Then click the plus sign of OLE DB (ADO) to eject the dialog box for the Select database
The "Current Connection" in "Project Data" displays OLE DB (ADO) connections. This allows you to add a table to the selected table on the right (remember: Do not select a table or command from "OLE DB" again from "current connection," If you use a dataset, the same thing, Otherwise all hint out "Landing failure" Error!)
3. Field data Manager inside the database field, drag the field directly into the crystalreport.rpt. Layout well.
4. Back to the WebForm1.aspx page, select the control crystalreportviewer to place it on the page.
The TableLogOnInfo class is: Provides properties for retrieving and setting table join options. It has a connection to the attribute ConnectionInfo, Used to set up a connection to the database. Generate a report document object to give it the crystalreport1.rpt that we do well in front of it. Here is the Database property! The report object is then made as a CrystalReportViewer1 data source.
Alternatively, the method of obtaining the database is changed to get the dataset directly from the database
Using System.Data.SqlClient;
Using System.Collections.Specialized;
String strconn=system.configuration.configurationsettings.appsettings["DB"]. ToString ();
using (SqlConnection conn = new SqlConnection (strconn))
{
SqlDataAdapter da = new SqlDataAdapter (strsql,conn);//strsql is SQL language "select * from Dbo.table1"
DataSet ds=new DataSet ();
Da. Fill (DS);
CrystalReport1 CR1 = new CrystalReport1 ();
CR1. Setdatasource (DS);
Crystalreportviewer1.reportsource = CR1;
The TableLogOnInfo class is: Provides properties for retrieving and setting table join options. It has a connection to the attribute ConnectionInfo, Used to set up a connection to the database. Generate a report document object to give it the crystalreport1.rpt that we do well in front of it. Here is the Database property! The report object is then made as a CrystalReportViewer1 data source.
Alternatively, the method of obtaining the database is changed to get the dataset directly from the database
Using System.Data.SqlClient;
Using System.Collections.Specialized;
String strconn=system.configuration.configurationsettings.appsettings["DB"]. ToString ();
using (SqlConnection conn = new SqlConnection (strconn))
{
SqlDataAdapter da = new SqlDataAdapter (strsql,conn);//strsql is SQL language "select * from Dbo.table1"
DataSet ds=new DataSet ();
Da. Fill (DS);
CrystalReport1 CR1 = new CrystalReport1 ();
CR1. Setdatasource (DS);
Crystalreportviewer1.reportsource = CR1;
The TableLogOnInfo class is: Provides properties for retrieving and setting table join options. It has a connection to the attribute ConnectionInfo, Used to set up a connection to the database. Generate a report document object to give it the crystalreport1.rpt that we do well in front of it. Here is the Database property! The report object is then made as a CrystalReportViewer1 data source.
Alternatively, the method of obtaining the database is changed to get the dataset directly from the database
Using System.Data.SqlClient;
Using System.Collections.Specialized;
String strconn=system.configuration.configurationsettings.appsettings["DB"]. ToString ();
using (SqlConnection conn = new SqlConnection (strconn))
{
SqlDataAdapter da = new SqlDataAdapter (strsql,conn);//strsql is SQL language "select * from Dbo.table1"
DataSet ds=new DataSet ();
Da. Fill (DS);
CrystalReport1 CR1 = new CrystalReport1 ();
CR1. Setdatasource (DS);
Crystalreportviewer1.reportsource = CR1;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.