Logon failed.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
I am getting the above error in my code. It is in C#.NET(Crystal Report).
I have given below my code here.
try
{
crReportDocument = new BillCrstlRpt();
crReportDocument.Load();
crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "Provider=Microsoft.Jet.OLEDB.4.0";
if(varClient == "Honda Power"
{
crConnectionInfo.DatabaseName = "\\\\Paragon\\databases\\Super_6\\Test\\ParaNet\\Hondasl_new.mdb";
}
else
{
crConnectionInfo.DatabaseName = "\\\\Paragon\\databases\\Super_6\\Test\\ParaNet\\sl_new.mdb";
}
crConnectionInfo.UserID = "Admin";
crConnectionInfo.Password = "";
crDatabase = crReportDocument.Database;
crTables = crDatabase.Tables;
foreach(CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
crParameterFieldDefinitions = crReportDocument.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["Client"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = varClient ;
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
//access first parameter field definition
crParameterFieldDefinitions = crReportDocument.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["IsActive"] ;
// Add parameter value
crParameterValues = crParameterFieldDefinition.CurrentValues;
//set discrete value
crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = true;
crParameterValues.Add(crParameterDiscreteValue);
// Apply the current value to the parameter definition
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crParameterFieldDefinition = crParameterFieldDefinitions["Processed"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterRangeValue = new ParameterRangeValue();
crParameterRangeValue.StartValue = varStartDate ;
crParameterRangeValue.UpperBoundType = RangeBoundType.BoundInclusive;
crParameterRangeValue.EndValue = varEndDate ;
crParameterRangeValue.LowerBoundType = RangeBoundType.BoundInclusive;
crParameterValues.Add(crParameterRangeValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
CrystalReportViewer1.ReportSource = crReportDocument;
}
I would highly appriciate any help on this.
Thanks in Advance.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.
I am getting the above error in my code. It is in C#.NET(Crystal Report).
I have given below my code here.
try
{
crReportDocument = new BillCrstlRpt();
crReportDocument.Load();
crConnectionInfo = new ConnectionInfo();
crConnectionInfo.ServerName = "Provider=Microsoft.Jet.OLEDB.4.0";
if(varClient == "Honda Power"
{
crConnectionInfo.DatabaseName = "\\\\Paragon\\databases\\Super_6\\Test\\ParaNet\\Hondasl_new.mdb";
}
else
{
crConnectionInfo.DatabaseName = "\\\\Paragon\\databases\\Super_6\\Test\\ParaNet\\sl_new.mdb";
}
crConnectionInfo.UserID = "Admin";
crConnectionInfo.Password = "";
crDatabase = crReportDocument.Database;
crTables = crDatabase.Tables;
foreach(CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
crParameterFieldDefinitions = crReportDocument.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["Client"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = varClient ;
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
//access first parameter field definition
crParameterFieldDefinitions = crReportDocument.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["IsActive"] ;
// Add parameter value
crParameterValues = crParameterFieldDefinition.CurrentValues;
//set discrete value
crParameterDiscreteValue = new ParameterDiscreteValue();
crParameterDiscreteValue.Value = true;
crParameterValues.Add(crParameterDiscreteValue);
// Apply the current value to the parameter definition
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crParameterFieldDefinition = crParameterFieldDefinitions["Processed"];
crParameterValues = crParameterFieldDefinition.CurrentValues;
crParameterRangeValue = new ParameterRangeValue();
crParameterRangeValue.StartValue = varStartDate ;
crParameterRangeValue.UpperBoundType = RangeBoundType.BoundInclusive;
crParameterRangeValue.EndValue = varEndDate ;
crParameterRangeValue.LowerBoundType = RangeBoundType.BoundInclusive;
crParameterValues.Add(crParameterRangeValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
CrystalReportViewer1.ReportSource = crReportDocument;
}
I would highly appriciate any help on this.
Thanks in Advance.