on 2025 Mar 11 12:48 PM
I am trying to run a Crystal Report using Crystal Report Runtime in my vb.net website. When the page loads into the browser, the report doesn't open. I get no messages or errors, just an empty browser. It behaves the same when I test it locally and on the server. Why doesn't the runtime load the report?
Here's my source code in the .aspx file:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="PrintEmergencyRpt.aspx.vb" Inherits="Security_Badge_Requests.PrintEmergencyRpt" %>
<%@ Register assembly="CrystalDecisions.Web, Version=13.0.4000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Crystal Report Viewer</title>
<style type="text/css">
.auto-style1 {}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" ReportSourceID="CrystalReportSource1" />
<CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
<Report FileName="~\AccessGrants-Emergency_Response.rpt">
</Report>
</CR:CrystalReportSource>
<br />
<asp:Button ID="Button1" runat="server" CssClass="auto-style1" Text="Button" Width="109px" />
<br />
</div>
</form>
</body>
</html>
Here's the code in the aspx.vb file:
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class PrintEmergencyRpt
Inherits System.Web.UI.Page
Protected Sub Page_init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Dim tbCurrent1 As CrystalDecisions.CrystalReports.Engine.Table
Dim tliCurrent1 As CrystalDecisions.Shared.TableLogOnInfo
Dim cr As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
Try
'Map the actual path on the server to the report file
Dim strPath As String = Server.MapPath("AccessGrants-Emergency_Response.rpt")
'Load the report
cr.Load(strPath, CrystalDecisions.Shared.OpenReportMethod.OpenReportByTempCopy)
For Each tbCurrent1 In cr.Database.Tables
tliCurrent1 = tbCurrent1.LogOnInfo
With (tliCurrent1.ConnectionInfo)
.UserID = "xxxxx"
.Password = "xxxxxxxxx"
End With
tbCurrent1.ApplyLogOnInfo(tliCurrent1)
Next tbCurrent1
'Set the source for the report
CrystalReportViewer1.ReportSource = cr
Catch ex As Exception
Response.Write("The Following Error has occurred: " & ex.InnerException.ToString)
End Try
cr = Nothing
End Sub
Here are the added references and the file version:
Please help, I have tried different code from AI, but nothing works.
Thank you.
Request clarification before answering.
You must use Sessions and PostBack to keep the report in scope.
See this KBA with example:
https://userapps.support.sap.com/sap/support/knowledge/en/1985571
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 5 | |
| 5 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.