Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Report on ASP.Net using VB.net code

Status
Not open for further replies.
Nov 5, 2004
27
0
0
PH
Hello to all,
I am new on ASP.net using vb.net code and i just want to know on how will i display crystal reports on web forms using the crystal viewer.I already know how to display it on visual basic 6 but it seems that it has a different approach in asp.net.Thanks.
 
Do a search on this forum for "Crystal". There's loads of threads on this subject with some helpful links.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Imports System

Public Class rpt
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Dim svr As String = System.Environment.MachineName
Dim qs As String = "&" & context.Request.QueryString.tostring
Dim rpt = Context.Request("rpt")
Dim cmd = context.request("cmd")
Dim cesm = CreateObject("CrystalEnterprise11.SessionMgr.1")
Dim ces = cesm.Logon("administrator", "password", svr, "secEnterprise")
Dim ceis = ces.Service("", "InfoStore")
Dim cetokmgr = ces.LogonTokenMgr
Dim cetok = cetokmgr.CreateLogonTokenEx("", 2, 100)
Dim sSQL As String = "Select SI_ID From CI_INFOOBJECTS Where SI_PROGID = 'CrystalEnterprise.Report' AND SI_INSTANCE = 0 AND SI_NAME = '" & rpt & "'"
Dim rID As Integer

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ceio = ceis.Query(sSQL)
Dim init As String = ""
If ceio.count > 0 Then
rID = ceio.item(1).ID
Else
Response.Write("Report " & rpt & " not found")
Exit Sub
End If
If cmd = "" Then init = "&init=java_plugin:connect"
Response.Redirect("/crystalreportviewers11/viewrpt.aspx?id=" & rID & _
"&apstoken=" & cetok & qs & init)
End Sub

Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Unload
cetok = Nothing
cetokmgr = Nothing
ceis = Nothing
ces = Nothing
cesm = Nothing
End Sub

End Class

If more than 1 goose are geese, why aren't more than 1 moose meese??
[censored][censored][censored]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top