Group: Forum Members
Posts: 3,
Visits: 8
|
Hi,
I am getting the following error while trying to insert a record using businessObject1.save():
Cannot insert explicit value for identity column in table 'MyTable' when IDENTITY_INSERT is set to OFF.
I tracked the problem and found out that the SQL generated to insert the record has the auto-increment primary id field set to NULL.
Things I tried:
1. I setted the ID field to readonly from the Business Object Mapper -> same error
2. I captured the exact SQL, removed the ID field and run it on SQL Server Management Studio -> worked at that run
3. I added the ID field to FieldsToExcludeFromInsert property of the business object -> the application gave the error: Cannot create INSERT command because the updating DataTable does not contain columns for all PrimaryKeyFields.
I compared the business object I created for that application with a business object from the samples - which also has a auto-increment primary key field (cust_pk), and it seems to have the same structure. I didn't see any difference that could be the reason of the problem I am having.
I am still trying to find the problem, but any help would be very much appreciated.
Thanks,
Buluc
|