on 08-04-2016 5:26 PM
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Don,
Thanks for your response, I'm using RAS Unmanaged SDK, all the code samples are here:
The report is not create in designer, first it is loaded by a dummy rpt file an then all the database and datafields are loaded from a dataset using XML. Please check this post ()
I have tried using the same code in one of the sample application with a pre-created report and it works.
All the FieldObject fails. TextObject, LineObject, Formula Fields and Special fields can be added correctly.
Any ideas about how to fix this?
Thanks!
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.