BDC Implicit Conversion Pitfall

I have been recently working on a MOSS BDC project and have been struggling with some ambiguous error messages that were occuring on when using BDC data columns in a custom list. The error I was receiving was:
   An error occurred while retrieving data from <BDC Database>. Administrators, see the server log for more information.
 
After checking the event viewer logs I realized this error message actually refers to the SharePoint logs in the 12 hiveLogs. After some investigation of the log I realized that my BDC application definition was expecting an Int64 value to be returned when in fact it was receiving an Int32. From a programming perspective it would seem that any Int32 value should fit within an Int64. The other way around should cause an overflow. The BDC complained like the Int64 data type resulted in a data type mismatch.
 
This problem illustrates that implicit conversions when using the BDC are not provided by the MOSS runtime, so it is VERY important to be sure that the type descriptors in the BDC application definition match exactly what is returned from a database or web service. I am sure there are other cases where a developer would expect an implicit conversion to occur but will not with the BDC.
 
When using the BDC Meta Man tool or the Microsoft BDC Editor, watch out for definitions that default to Int64 as the data type for a column because this could result in an error if an Int64 is actually not being returned. This is one very tricky issue in BDC development.
 
Thanks,
Advertisements

,

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: