| | | StrataFrame User
       
Group: StrataFrame Users Last Login: Today @ 7:46:31 AM Posts: 197, Visits: 225 |
| | I have a standard maintenance form, and am able to browse through the records no problem. However, when I try to add a record , I get an Invalid Cate Exception in code below. I have changed some fields recently on the database, but my Primary Key is SMA_PK which is set up as an INT field in the table.. this is what seems to be causing the error. I suspect I have not changed something somewhere .... /// <summary> /// SMA_PK /// </summary>[Browsable( false),BusinessFieldDisplayInEditor(), Description( "SMA_PK"),DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public System.Int32 SMA_PK{ get{ return (System.Int32)this.CurrentRow["SMA_PK"];} set{ this.CurrentRow["SMA_PK"] = value;} } |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: 08/31/2010 2:36:53 PM Posts: 6,287, Visits: 6,191 |
| | What is SMA_PK typed as within the DataTable? You are trying to cast it as an Int but it is either Null or a data type other than integer. |
| | | | StrataFrame User
       
Group: StrataFrame Users Last Login: Today @ 7:46:31 AM Posts: 197, Visits: 225 |
| | Hi Trent. In the Database Table, the Field SMA_PK is set up as Int Also, as the error is only happening when I try to 'Add',the question of whether it is Null should not arise ? |
| | | | 
StrataFrame Developer

Group: StrataFrame Developers Last Login: 08/31/2010 2:36:53 PM Posts: 6,287, Visits: 6,191 |
| | It sounds like you have turned off the auto-initialize option on the BO to pre-initialize the values. Or your are using a user def-ined PK and have the PrimaryKeyAutoIncremented property set to False and are not providing a PK in the SetDefaultvalues event of the BO. |
| |
|
|