Hello,
I have noticed that in MySQL, when you make a change to a record but the changes are actually identical to the original record (that is, taking a field with value “miki” and telling mysql to alter the content to “miki” ) it returns 0 rows affected.
This makes entity framework throw an exception.
I wonder if you are familiar with it... ?
Can you prevent such exception from raise at the dotConnect level?
Another question regarding entity framework migrations:
Currently I edit my migration classes to refer to the relevant database using Sql command for MySQL:
Sql("USE databaseName");
However, while this will work for MySQL, it will fail for Oracle / MsSql.
Is there a devart method to do that?
Best Regards,
Maya.
Update record with identical value raise exception
Re: Update record with identical value raise exception
Please include the "Found Rows=true;" entry in your connection string to fix the issue.mayash75 wrote:when you make a change to a record but the changes are actually identical to the original record it returns 0 rows affected.
This makes entity framework throw an exception.
The Found Rows connection string parameter determines whether the provider will return the number of rows matched by the WHERE condition of the UPDATE statement instead of the rows actually changed. Default value is false.
This feature was implemented in dotConnect for MySQL starting from the 7.0.25 version: http://www.devart.com/dotconnect/mysql/ ... story.html .
1. Oracle:mayash75 wrote:Currently I edit my migration classes to refer to the relevant database using Sql command for MySQL:
Sql("USE databaseName");
However, while this will work for MySQL, it will fail for Oracle / MsSql.
a) try the following SQL via Sql command:
Sql("alter session set current_schema=AnotherUser");
b) you can also execute the same SQL via the Initialization Command connection string parameter of OracleConnection: http://www.devart.com/dotconnect/oracle ... tring.html . The same connection string parameter is available in dotConnect for MySQL.
2. SQL Server:
Tell us the exact text of the error when you are executing Sql("use [database name]"); for SQL Server.