Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to retrieve the new primary key?
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00809477
Message ID:
00811190
Views:
23
>>The problem is with the CommandBuilder and not MMF. YOu will need to set the default values for each column that is not configured to accept nulls.
>
>I ran some tests with SQL Profiler and found that the generated SQL command contains "iRecVersion = NULL" when RetrieveAutoIncrementPK = true. When RetrieveAutoIncrementPK = false, iRecVersion is not in the SQL command at all.
>

Reverse the order of your test and make sure it is still working the way you expect. For example, if you had RetrieveAutoIncrementPK = false the first time then try RetrieveAutoIncrementPK = true for the first test.

The reason why I say this is that I noticed something unusual when I added records. The first time I saved it was only inserting fields that I had changed (allowing the insert to use SQL's defaults). The second time that I saved a new record it would send nulls for the columns that I didn't change (giving me errors on the columns that don't accept null values). I haven't yet gotten to the bottom of it but I had to set defaults for all the columns in my business object.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform