Hello,
I'm trying to add a database field to a Crystal Report using RAS SDK, but when the field is being added to the ReportObjectController an exception is raised:
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in ...
Additional information: The report field type is not valid.
This is the code used to create and add the field:
Dim fldObj As CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject
fldObj = New CrystalDecisions.ReportAppServer.ReportDefModel.FieldObject()
fldObj.DataSourceName = rsFields("TableName") & "_" & rsFields("FieldName")
fldObj.Left = rsFields("FieldLeft")
fldObj.Top = rsFields("FieldSectionTop")
fldObj.Name = rsFields("FieldName")
fldObj.FieldValueType = CrystalDecisions.ReportAppServer.DataDefModel.CrFieldValueTypeEnum.crFieldValueTypeStringField
pRpt.ReportClientDocument.ReportDefController.ReportObjectController.Add(fldObj, crSection, -1) 'Exception is raised
I have checked that DataSourceName is in the data source and the data definition of the report.
Can anyone help me with this?
Thanks in advance
Hi Gonzalo,
What SDK are you using and is it the latest?
If you create a report using CR Designer and add that field does it work and how is it reported?
Does it fail on all string fields or just this one?
Don
Add a comment