I saw the documentation of the "ASP.NET used in ASP.NET" written for a few days ago, self-inductance has been self-employed. But there is a little problem here and want to explore it. The method and code provided by the flying knife for the RPT file in Samples can be displayed normally, but when you create a RPT file, you will have the error message of 'login failed'! After making some adjustments, the implementation is as follows:
First join: using crystaldecisions.shared; using crystaldecisions.crystalReports .Engine; // Namespace instructions for viewing VS help documentation
Second, if the RPT file created by the user is CrystalReport1.rpt, the following is true:
private void Page_Load (object sender, System.EventArgs e) {TableLogOnInfo logOnInfo = new TableLogOnInfo (); ReportDocument Rd = new ReportDocument (); Rd.Load ( "C: //Inetpub//wwwroot//NetPrintTest//CrystalReport1.rpt "); logOnInfo.ConnectionInfo.ServerName = localhost; logOnInfo.ConnectionInfo.DatabaseName = northwind; logOnInfo.ConnectionInfo.UserID = sa; logOnInfo.ConnectionInfo.Password = sa; Rd.Database .Tables [0] .ApplyLogOnInfo (logOnInfo); CrystalReportViewer1 .Reportsource = rd;}
This will not have a problem with failure!
Goodday ~~~~~~~~~~~~~~~~~~