This is a migrated thread and some comments may be shown as answers.

mysql insert fails due to identity = 0

2 Answers 40 Views
Development (API, general questions)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Anthony
Top achievements
Rank 1
Anthony asked on 27 Aug 2014, 03:33 AM
I have two identical databases in MSSQL and MySQL to test my app. It works perfectly in MSSQL, but it fails after trying to insert in MySQL. The debugger shows it failing right after  

this.context.Add(this.CurrentReport);
this.context.Save();

The debugger also shows this after the Add operation:

OpenAccessEnhancedFlags -1
OpenAccessEnhancedStateManager PCStateMan GeotechReport NEW


The MSSQL run shows the same information, so maybe it isn't significant, but I thought I'd at least mention it. The MySQL database column called RowID is set to be primary key, auto increment, unsigned, not null. The rlinq property called identity mechanism is assigned to DatabaseServerCalculated as the documentation suggests.

What am I missing?

2 Answers, 1 is accepted

Sort by
0
Anthony
Top achievements
Rank 1
answered on 27 Aug 2014, 04:07 PM
Well, I can't explain why, but now it works. I deleted the domain model project and started over completely. I did everything the same, but maybe in a different order. I had previously used a domain model that linked to SQL Server 2014 in the project, which I deleted before I added a domain model that linked to MySQL.

I also recreated the underlying table, so maybe I had a setting wrong in one of the two places (the domain model or the table). It works now, though.
0
Ralph Waldenmaier
Telerik team
answered on 28 Aug 2014, 02:46 PM
Hello Anthony,
First I am glad that now your project is working as expected. Nevertheless we would be interested in what was causing the issue. So in case you experience this behavior again, please contact us again.

Feel free to ask in case you have any other question.

Regards,
Ralph Waldenmaier
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Development (API, general questions)
Asked by
Anthony
Top achievements
Rank 1
Answers by
Anthony
Top achievements
Rank 1
Ralph Waldenmaier
Telerik team
Share this question
or