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:
00810697
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 am not overriding any of the SQL command in the data layer, which mean MM.NET is using the commandbuilder. Do you mean I have to tell the data object which field is not allow null if I want to retrieve the primary key? Is this also mean the default value in SQL schema is not compatiable with MM.NET?
>
>Stephen
>
>
>
>>The default values are not used by ADO.NET to store the values before performing the update. That is handled by the SQL Server. When you set the flag in MMF to retrieve the primary key, it appends a select statement to the insert. Are you building you own insert statement or are you having MMF use the commandbuilder? If using the commandbuilder, you will want to set the default values of the fields or set AllowNulls to true.
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform