So verwenden Sie Crystal Reports mit ASP.Net 2.0. Beliebige Beispiele/Anleitungen/Beispiele, die zeigen, wie Crystal Reports auf einem Produktionsserver bereitgestellt wird.Wie verwendet man Crystal Reports mit ASP.NET?
Antwort
Nachdem ich gerade gewesen von dieser durch den Schmerz, hier ein paar Hinweise, die Sie hoffentlich Zeit sparen ...
Crystal Reports on MSDN - viele gute Sachen in der hier
Which Persistence Approach Should I Use with Crystal Reports - gibt Detail und Code besten Proben, wie die lifesycle eines Berichts Objekt zu steuern
This post gibt auch einige gute Ratschläge rund um den Bericht Objekt Lifecycle
Deployment ... Th Die neuesten Crystal Reports-Laufzeiten können nicht in einer 64-Bit-Umgebung ausgeführt werden. Wenn Sie sie auf einem 64-Bit-Server bereitstellen, müssen Sie entweder IIS für die Ausführung eines 32-Bit-Modus konfigurieren oder eine frühere Version der Laufzeit verwenden. \ Programme \ Microsoft SDKs \ Windows \ V6.0A \ Bootstrapper \ Packages \ CrystalReports10_5
: Ich habe das meiste Glück mit der Laufzeit hatte, die mit VS2008 verteilt wird, kann dies inC finden
Ich bemerke, dass Sie ASP.NET 2.0 verwenden - ich bin sicher, dass es eine äquivalente VS2005-Laufzeit gibt. Versuchen Sie, die Implementierungsumgebung früh im Projekt zu verwenden, da dies zweifellos mehr Kopfschmerzen verursacht, als Sie erwarten.
Ein letzter Punkt, der uns einige Zeit gekostet hat und erwähnenswert ist - der Standardparameterbildschirm in Crystal Reports wird Sie nur so weit bringen. Wenn Sie mit der Darstellung Ihrer Parameter für den Benutzer komplex werden möchten (z. B. indem Sie Parameter abhängig von der Auswahl eines anderen Parameters haben), müssen Sie Ihre eigenen Parameterbildschirme rollen. Dies ist ziemlich einfach, da das Objektmodell Ihnen Zugriff auf alle Informationen gibt, die Sie über Parameter benötigen. Wir haben den Weg zur Erstellung eines generischen Parameterbildschirms, der sich gemäß den Parametern des Berichts, auf den er gerichtet ist, selbst erstellt.
Dies ist der Code, den ich verwenden in der Regel:
'Generate the Report
Dim oRpt As New ReportDocument
Dim reportPath As String = Server.MapPath("crtTAL.rpt")
oRpt.Load(reportPath)
oRpt.SetDataSource(dsTAL)
If Not IO.Directory.Exists(tempLocation) Then
IO.Directory.CreateDirectory(tempLocation)
End If
If IO.File.Exists(tempLocation & filename) Then
IO.File.Delete(tempLocation & filename)
End If
' ********************************
' First we must create a new instance of the diskfiledestinationoptions class and
' set variable called crExportOptions to the exportoptions class of the reportdocument.
Dim crDiskFileDestinationOptions As New DiskFileDestinationOptions
Dim crExportOptions As ExportOptions = oRpt.ExportOptions
'Export to Word
'append a filename to the export path and set this file as the filename property for
'the DestinationOptions class
crDiskFileDestinationOptions.DiskFileName = tempLocation + filename
'set the required report ExportOptions properties
With crExportOptions
.DestinationOptions = crDiskFileDestinationOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.WordForWindows
End With
'Once the export options have been set for the report, the report can be exported. The Export command
'does not take any arguments
Try
' Export the report
oRpt.Export()
oRpt.Close()
oRpt.Dispose()
projectCount = projectCount + 1
Catch err As Exception
Response.Write("<BR>")
Response.Write(err.Message.ToString)
errorList = errorList & dtrProjects.Item("Title") & "; "
End Try
Das ist, was ich in der Regel verwenden, Asp.net/C#
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
///create instance of class first
ReportDocument rpDoc = new ReportDocument();
///load the report
rpDoc.Load(@"TicketingBasic.rpt");
///pass the report to method for dataInfo
getDBInfo(rpDoc);
/// et the source for report to be displayed
CrystalReportViewer1.ReportSource = rpDoc;
}
protected static void getDBInfo(ReportDocument rpDoc)
{
///Connection Onject
ConnectionInfo cn = new ConnectionInfo();
///DataBase,Table, and Table Logon Info
Database db;
Tables tbl;
TableLogOnInfo tblLOI;
///Connection Declaration
cn.ServerName = "??????";
cn.DatabaseName = "???????";
cn.UserID = "???????";
cn.Password = "????????";
//table info getting from report
db = rpDoc.Database;
tbl = db.Tables;
///for each loop for all tables to be applied the connection info to
foreach (Table table in tbl)
{
tblLOI = table.LogOnInfo;
tblLOI.ConnectionInfo = cn;
table.ApplyLogOnInfo(tblLOI);
table.Location = "DBO." + table.Location.Substring(table.Location.LastIndexOf(".") + 1);
}
db.Dispose();
tbl.Dispose();
}
und auf Aspx Seite:
<CR:CrystalReportViewer
ID="CrystalReportViewer1"
runat="server"
AutoDataBind="true"
EnableDatabaseLogonPrompt="false"
/>
- 1. Crystal Reports + Asp.net 2.0
- 2. Welche Version von Crystal Reports verwendet 13.0.2000?
- 3. Blob-Felder in Crystal Reports mit ASP.Net
- 4. Crystal Reports
- 5. Crystal Reports und LINQ
- 6. css mit Crystal Reports
- 7. Crystal Reports Bilder und ASP.Net MVC
- 8. Crystal Reports-Datenquellendiagramm verschwindet
- 9. Crystal Reports - inkonsistente Formatierung
- 10. WPF-Anwendung mit Crystal Reports
- 11. Crystal Reports Crosstab Hervorhebung
- 12. Drucken Barcode mit Crystal Reports
- 13. Crystal Reports Framework
- 14. Wie integriert man Crystal Reports mit Ruby On Rails?
- 15. Auto Refresh Crystal Reports
- 16. Crystal Reports-Parameter ändern
- 17. Crystal Reports Layout
- 18. Crystal Reports-Konfigurationstool
- 19. Crystal Reports Css-Klasse
- 20. Crystal Reports: Sumarize Formelfeld
- 21. Crystal Reports-Bericht - Kopfunterdrücken
- 22. Crystal Reports Summieren
- 23. Crystal Reports SDK-Fehler
- 24. Problem mit Crystal Reports-Bericht in ASP.NET - ExportToHttpResponse
- 25. Crystal Reports Datumsfunktionen
- 26. Lokalisierte Crystal Reports
- 27. Crystal Reports-Datenbankverbindungsprobleme
- 28. crystal reports Bild zerquetscht
- 29. Crystal Reports Optionaler Parameter
- 30. Crystal Reports DateTime-Formatierung