Jigsaw Blog

22

Jan
2015
0 comments

CrystalDecisions.CrystalReports.Engine.InternalException: Failed to retrieve data from the database

Suddenly started to receive the error
CrystalDecisions.CrystalReports.Engine.InternalException: Failed to retrieve data from the database. Details:
[Database Vendor Code: 242 ]
Failed to retrieve data from the database.

Situation:
asp.net framework 45. web site
running a crystal report and exporting to MS Word
The backend server was changed from SQL2005 to SQL2012
The export to word stopped working after the move.

Error:
CrystalDecisions.CrystalReports.Engine.InternalException: Failed to retrieve data from the database. Details:
[Database Vendor Code: 242 ]
Failed to retrieve data from the database.

The issue is not Crystal.
We are using Microsoft SQL Server. The key is to look at the section
[Database Vendor Code: 242 ]
The Database is MS SQL Server, Code 242 means a type conversion error.

Fix:
The report was using a stored procedure with many parameters.
One of the paramters was a date but was being passed as a string with format dd/MM/yyyy.
The user connecting to SQL had the wrong language specified - English. We corrected this it British and all was good again.