The company's project needs to use CrystalReport to do a report. I have made some tests today. I have encountered some problems in this process. Here to share with you, I hope to help those who learn CrystalReport.
I. There are two models of Crystalreport: Pull Model and Push Model
??????? I think it differs from the source of data.
??????? pull model?: Use the CrystalReport and database to establish a connection to obtain data in the design phase, programmers do not have to encode yourself.
????? push model: In the design phase of the report, only reports through some virtual data structural files (XML, Dataset ..).
????????????????????????????????? programmer needed its own code to take the data, then pass it to the report
II. Use the PULL MODEL to log in to the error
????? I encountered a problem when using this mode, it was running the database login error.
????? Error message: Exception Details: CrystalDecisions.crystalReports.Engine.logonexception: Logon Failed
????? I searched the relevant article online and then solved the problem.
????? In fact, the problem is that this mode is connected to the database in the design phase and the database is connected to the database. When running the program, it must first verify the database.
????? Solution is as follows:
???????????????????? {??? {p?? = stalreport1 report = new crystalReport1 (); ?????? connectioninfo CONNINFO = new connectioninfo (); ??? conninfo.servername =? "server name"; ??? connifo.databaseename = "database name"; ??? CONNINFO.USERID = "user"; ??? conninfo.password = "password"; ?????? Crystaldecisions.crystalreports.Engine.Table TBL; ??? TablelogonInfo LogonInfo = New TableLogonInfo (); ?????? for (int i = 0; i ??? this.crystalReportViewer1.reportsource = report; ??} III. In the process of use, the parameters are used, so how do you pass parameters to CrystalReport? ??? CrystalReport2 rpt = new CrystalReport2 (); ???? ParameterValues pv = new ParameterValues (); ???? ParameterDiscreteValue pdv = new ParameterDiscreteValue (); ???? pdv.Value = "Category Type List" ;? ??? pv.add (pdv); ???? rpt.dataDefinition.Parameterfields ["reporttitle"]. ApplyCurrentValues (PV); 4. How to pass data to CrystalReport when using the PUSH Model mode ???? DataSet Objds = New dataset (); ????????? objds = dataaccess.master.categoryAccess.GetDataList (""); ???? CrystalReport2 RPT = New CrystalReport2 (); ??????? f (objds! = null && objds.tables [0] .rows.count> 0) ???? {????? rpt.setDataSource (Objds.tables [0]);? ??????? this.crystalReportViewer1.reportsource = rpt; ????}? The level is limited, just try to point the skin, I hope the master will advise. I hope this can help people in need. :) I am a programmer, friends who need to communicate can contact me one. Denny_lzh@hotmail.com