StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Maintenenanced Form- Add buttom giving...Expand / Collapse
Author
Message
Posted 07/01/2009 10:32:38 AM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame 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;

}

}

Post #23724
Posted 07/01/2009 11:37:07 AM


StrataFrame Developer

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.
Post #23725
Posted 07/01/2009 12:28:34 PM
StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame 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 ? 

Post #23727
Posted 07/01/2009 1:37:02 PM


StrataFrame Developer

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.
Post #23733
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Trent L. Taylor, Steve L. Taylor, Dustin Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 8:35am

Powered by InstantForum.NET v4.1.4 © 2010
Execution: 0.109. 7 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.