1
Answer

Crystal Report Error Vendor Code : 241

Deep Ghetiya

Deep Ghetiya

10y
2.3k
1
I develop a Window application in C# window application with Visual Studio 2012
for that i used Crystal Reporting  Service

in Crystal report I append  Stored Procedure  as Data-Source which wants 4 parameters

I passed that parameter from C# window form with this below code
 
 ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(@"E:\TestDatabase\TestDatabase\RejectionReport.rpt");

ConnectionInfo crConnectionInfo = new ConnectionInfo();

crConnectionInfo.ServerName = @".\SqlExpress";
crConnectionInfo.DatabaseName = "testdatabase";
crConnectionInfo.IntegratedSecurity = true;

ParameterFieldDefinitions crParameterFieldDefinitions;
ParameterFieldDefinition crParameterFieldDefinition;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

crParameterDiscreteValue.Value = dateTimePickerFromRejectionReport.Text;
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["@FromDate"];
crParameterValues = crParameterFieldDefinition.CurrentValues;

crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

crParameterDiscreteValue.Value = dateTimePickerToRejectionReport.Text;
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["@ToDate"];
crParameterValues = crParameterFieldDefinition.CurrentValues;

crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
crParameterDiscreteValue.Value = CBItemTypeRejectionRpt.Text;

crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["@Type"];
crParameterValues = crParameterFieldDefinition.CurrentValues;

crParameterValues.Clear();
crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);


crParameterDiscreteValue.Value = "HT";
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["@RegStage"];
crParameterValues = crParameterFieldDefinition.CurrentValues;

crParameterValues.Add(crParameterDiscreteValue);
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);

crystalReportViewer1.ReportSource = cryRpt;
crystalReportViewer1.Refresh();


this all parameters are passed successfully in my report but at the loading time of report in report viewer I got the Error

"Failed to retrieve data from the database Database Vendor Code : 241
Error in File Rejection Reprort {a6sd78t3287-2167-sdfg3-8asdgbgbsadh}.rpt
Failed to retrieve data from the database.
Detais [Database Vendor Code : 241]"

 
please help me to solve this out

 
 
Answers (1)