

MyReport.Load(Server.MapPath("ReportName")) - name of the crystal reportĭim myTables As Tables = įor Each myTable As In myTablesĭim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo Then, in the Page_Init handler, re-apply connection info: Dim m圜onnectionInfo As ConnectionInfo = New ConnectionInfo() In case that link dies, the solution is in two steps:įirst, import these: Imports CrystalDecisions.Shared This article provides code examples and a link to MSDN explaining the ConnectionInfo class and how it works in this context. Essentially, the authentication details are reset on a postback and need to be reassigned in the Page_Init handler. This is a common problem with embedding Crystal Reports in ASP pages. We must call the parameter's name without any additional character such or ?, just only the parameter's name itself. RptH.ExportToHttpResponse(ExportFormatType.PortableDocFormat, .Response, false, "GL") RptH.SetParameterValue("Date_To", todate) ĬrConnectionInfo.ServerName = "YOUR SERVER NAME" ĬrConnectionInfo.DatabaseName = "YOUR DATABASE NAME" ĬrConnectionInfo.UserID = "YOUR DATABASE USERNAME" ĬrConnectionInfo.Password = "YOUR DATABASE PASSWORD" įoreach ( CrTable in CrTables)ĬrtableLogoninfo.ConnectionInfo = crConnectionInfo ĬrTable.ApplyLogOnInfo(crtableLogoninfo) RptH.SetParameterValue("Date_From", fromdate) RptH.Load(Server.MapPath("~/Rpts/G1.rpt"))


TableLogOnInfo crtableLogoninfo = new TableLogOnInfo() ĬonnectionInfo crConnectionInfo = new ConnectionInfo()

TableLogOnInfos crtableLogoninfos = new TableLogOnInfos() Then we we must give database access to the report because without login to database the report will not be opened.Īnd here is the code: ReportDocument rptH = new ReportDocument() NOT rptH.SetParameterValue("?Date_From", fromdate) //incorrect We should pass the parameter value like this: rptH.SetParameterValue("Date_From", fromdate) //correct
