asp.net - How do I load external Crystal Reports (2008) files in c#? -
Can anyone tell me that external crystal rocks (2008). Is it possible to load RPT files? Now I embed them so that they compile with my original.
It would be nice if I make any changes in any report layout without rebooting. Is this possible?
Thank you.
Yes, it is possible in the following example, the .rpt file can be uploaded and then a Standard ASP.NET CrystalReportViewer
is set as the source of control (in this case, reportViewer
).
using CrystalDecisions.CrystalReports.Engine;
...
report document document = new report document (); Document.Load (reportPath); //"C:\\path\\to\\report\\file.rpt "; ReportViewer.ReportSource = Document; ReportViewer.RefreshReport ();
If the database credentials embedded in the .rpt file are incorrect, then they can be set as:
using CrystalDecisions.Shared Tax;
...
Private Zero ViewReport () {ConnectionInfo connInfo = new ConnectionInfo (); ConnInfo.ServerName = "dbservername"; ConnInfo.DatabaseName = "dbname"; ConnInfo.userID = "dbusername"; ConnInfo.Password = "dbpassword"; ReportViewer.ReportSource = GetReportSource (connInfo); ReportViewer.RefreshReport (); } Private Report Dockground GetReportSource (ConneInInfo connInfo) {Report Document Document = New Report Document (); Document.Load (reportPath); //"C:\\path\\to\\report\\file.rpt "; TableLogOnInfos logoninfo = New TableLogOnInfos (); TableLogOnInfo logonInfo = New TableLogOnInfo (); Tables table; Tables = documents; database tables; Forwarding (crystallized crystalline. Table in engine table) {logonInfo = table.LogOnInfo; LogonInfo.ConnectionInfo = connInfo; Table.ApplyLogOnInfo (logonInfo); } Return Document; }
Comments
Post a Comment