#Asp.net crystal report viewer code#
' Put user code to initialize the page here End Sub Sub ExportReport()ĭim oStream As New MemoryStream ' // using System.IO ' this contains the value of the selected export format. Object,_īyVal e As System.EventArgs) Handles MyBase.Load Private Sub Page_Load( ByVal sender As System. ' city = Parameter Name ' Mumbai = Parameter Value ' :-) thats ALL your Report Will Be displayed ' now Without Logon Failed Error With DropDownList1.Items ' IF REPORT Uses Parameter's ' Pass Paramaters As FollowsĬrReportDocument.SetParameterValue( " city", " Mumbai") ' the Above line works even if only username ' and password is supplied as below ' crReportDocument.SetDatabaseLogon("username",_ " password") ', "sql-server", "database") ' this will hide the group treeĬrystalReportViewer1.DisplayGroupTree = FalseĬrystalReportViewer1.ReportSource = crReportDocument ' this is the most IMPORTANT line of code ' if this line is not writen the ' " LOGON FAILED" error starts displayingĬrReportDocument.SetDatabaseLogon( " username",_ ' CODEGEN: This method call is required by the Web Form Designer ' Do not modify it using the code editor. Object,_īyVal e As System.EventArgs) Handles MyBase.Init Object Private Sub Page_Init( ByVal sender As System. Private designerPlaceholderDeclaration As System. ' This call is required by the Web Form Designer.Įnd Sub ' NOTE: The following placeholder declaration is required ' by the Web Form Designer. #Region " Web Form Designer Generated Code " Protected WithEvents Button2 As .WebControls.Button Protected WithEvents CrystalReportViewer1 As _ Protected WithEvents Label1 As .WebControls.Label
Protected WithEvents Button1 As .WebControls.Button Protected WithEvents DropDownList1 As .WebControls.DropDownList Shared Imports System.IOĭim crReportDocument As CrystalReport2 = New CrystalReport2