- FieldMapping Event does not work in .NET
- Visual Studio 2010
- Crystal Report For Visual Studio 2010
- .NET FRAMEWORK 4.0
Reproducing the Issue
- Download the .zip attachment named ConsFieldMapping.zip. It contains a .NET Console project, a report and a database on which the report is based.
The report initially is based on an OBDC connection that the .NET Console project uses to set the table to a Command Table.
The .NET Console project contains also the implementation of the FieldMapping event to map the report with the new field (since the field in the Command Table is different from the original field in the report).
- When running the .NET Console project against the report in Debug mode, we notice that the registered delegate by the event in our case named crpe_FieldMapping and registered like this:
crpe.FieldMapping +=new CrystalDecisions.CrystalReports.Engine.FieldMappingEventHandler(crpe_FieldMapping); is not called despite that all the conditions to trigger the event are set (like calling Verify Database or enabling Verify on Every Print or Setting the Location).
- The FieldMapping event does not work/fire.
FieldMapping event will only be triggered by the following method; SetSQLCommandTable like this:
reportDocument.SetSQLCommandTable(connectionInfo, newTableName, sqlQueryString);
With reportDocument of type ReportDocument
With connectionInfo of type ConnectionInfo
With newTableName of type String
With sqlQueryString of type String
Refer to the attachment for the .NET project.
FieldMapping Event does not work in .NET; FieldMapping Event in .NET; FieldMapping Event; FieldMapping; Crystal Report .NET , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , BI-DEV , Business Intelligence Software Development Kits (SDKs) , Problem