StrataFrame Forum

Problem adding first record to table

http://forum.strataframe.net/Topic21167.aspx

By Rylster - 12/12/2008

Hi there, my first post.

I have this problem with all my window forms. When I try to add a record to table with no records I get

"InvalidCastException was unhandled by user code".

The field is a text field in which null is not allowed. There is a default value set.

If there are already 1 or more records in the table no error occurs.

I can see that the Add method of the BO is calling the Get method for the text field. Why does it do this on an Add action?

Thanks in advance for any help.

By Trent L. Taylor - 12/12/2008

Well, you have a few details that are left out so let's fill in a few blanks.  A cast exception is going to occur anytime that you try to stuff a data type of one type into another without any type of conversion (i.e. attempt to place a string into an integer).  This can come from literally an unlimited number of things.  So if you could post the stack trace, that would be great.  Also, from just hearing what you are dealing with, have you mapped the BO through the BO Mapper and rebuilt the partial classes for your BOs?