Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Force .AutoIncrementCustom
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00994225
Message ID:
00994590
Views:
15
Mike,

>I'm finding that .AutoIncrementCustom doesn't take affect until after the physical table is "touched". Specifically, if I call myBusinessObject.NewRow() before any actual data access occurs, MM can't tell that there's an autoincrement column. More specifically, this if statement returns false:
>
>// mmBusinessObject.cs line 3661
>if (ds.Tables[tableName].ExtendedProperties.Contains(AUTOINCREMENTCOLUMN))
>{
>	AIColumn = ds.Tables[tableName].ExtendedProperties[AUTOINCREMENTCOLUMN].ToString();
>	ds.Tables[tableName].Columns[AIColumn].AutoIncrement = false;
>}
>
>
>So even though I specify .AutoIncrementCustom = true in the business object, my new row's PK value is 0, instead of -1.
>
>Should I just select a bogus record from the table to get this working? Seems easy but wrong (my table may also be empty of records). Any way to force this?

The reason you're seeing this is because you are using untyped DataSets which are dynamically created the first time data is retrieved from the back end. I recommend calling the business object's GetEmptyDataSet() before adding your first new row.

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Reply
Map
View

Click here to load this message in the networking platform