Crystal Report - Database Logon Failed
-
Hi, I have an XML file which is stored in a folder named XML and i have an RPT file (stored in CrystalReports folder) which has been designed by using this XML file as datasource. The report works fine in my local machine. But, when released in the server it is not working, it is giving the message like "Database logon failed". My Code behind, repDoc = New CrystalDecisions.CrystalReports.Engine.ReportDocument repDoc.Load(Server.MapPath("~/Reports/CrystalReport/MyReport.rpt"), CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault) repDoc.SetDataSource(Server.MapPath("~/Reports/XML/MyXML.xml")) CrystalReportSource.Report.FileName = Server.MapPath("~/Reports/CrystalReport/MyReport.rpt") Do anyone know why it is not working. Regards N.Surendra Prasad ;)
-
Hi, I have an XML file which is stored in a folder named XML and i have an RPT file (stored in CrystalReports folder) which has been designed by using this XML file as datasource. The report works fine in my local machine. But, when released in the server it is not working, it is giving the message like "Database logon failed". My Code behind, repDoc = New CrystalDecisions.CrystalReports.Engine.ReportDocument repDoc.Load(Server.MapPath("~/Reports/CrystalReport/MyReport.rpt"), CrystalDecisions.Shared.OpenReportMethod.OpenReportByDefault) repDoc.SetDataSource(Server.MapPath("~/Reports/XML/MyXML.xml")) CrystalReportSource.Report.FileName = Server.MapPath("~/Reports/CrystalReport/MyReport.rpt") Do anyone know why it is not working. Regards N.Surendra Prasad ;)
Hi I have the same problem. But I pass the crediential to the report at run time Code: Dim myFields As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions Dim thisField As CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition Dim myValue As CrystalDecisions.Shared.ParameterDiscreteValue Dim my_Param_Name As String Dim my_Param_Kind As CrystalDecisions.Shared.ParameterValueKind Dim crCurrentValues As CrystalDecisions.Shared.ParameterValues Dim _report As New CrystalDecisions.CrystalReports.Engine.ReportDocument _report = New CrystalDecisions.CrystalReports.Engine.ReportDocument _report.Load(Server.MapPath("~/Report/Extraction_Event.rpt")) _report.SetDatabaseLogon("XXX_USER_NAME", "XXX_PASSWORD", "SERVERNAME", "DATABASENAME") myFields = _report.DataDefinition.ParameterFields For Each thisField In myFields myValue = New CrystalDecisions.Shared.ParameterDiscreteValue my_Param_Name = "_GUID" 'thisField.ParameterFieldName my_Param_Kind = thisField.ParameterValueKind myValue.Value = Session("_GUID").ToString '"" _DTParameter.Rows(i).Item(1) crCurrentValues = thisField.CurrentValues crCurrentValues.Add(myValue) thisField.ApplyCurrentValues(crCurrentValues) Next CrystalReportViewer1.EnableDatabaseLogonPrompt = False CrystalReportViewer1.ReportSource = _report End Sub