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!

Logon failed error in Crystal Report

Status
Not open for further replies.

z07924

IS-IT--Management
Feb 18, 2002
122
0
0
GB
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.
 
Hi try this

{

crConnectionInfo.DatabaseName = "\\Paragon\databases\Super_6\Test\ParaNet\Hondasl_new.mdb";

}
else
{
crConnectionInfo.DatabaseName = "\\Paragon\databases\Super_6\Test\ParaNet\sl_new.mdb";

}

cheers






pgtek
 
It is basically an excape character. It doesn't matter.
Anyway I tried that. It doesn't work out for me.

Is there any other way to resolve this problem?

I would highly appriciate any help.

Thanks in Advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top