ChangeConflictException <- type 'Date' or 'DateTime'

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
nomauci
Posts: 2
Joined: Tue 07 Dec 2010 04:43

ChangeConflictException <- type 'Date' or 'DateTime'

Post by nomauci » Tue 07 Dec 2010 05:10

I use Entity Developer create the class.
I found that if include field with type 'Date' or 'DateTime'

ChangeConflictException catch in DC.SubmitChanges();

( just change record.)
( insert new record is ok.)

Type 'Time' is ok.

Server is MySQL server version 4.1.7-nt

and, my system language is Chinese.

now, i change to varchar for datetime.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Tue 07 Dec 2010 18:02

Could you please specify the following:
- the version of dotConnect for MySQL you are using;
- the message and stack trace of the exception you are receiving;
- the definition of the table with which the problem occurs.

If possible, please send us a model or a complete test project with which the issue can be reproduced. We couldn't reproduce it in our environment with the latest 6.0.58 version of dotConnect for MySQL.

nomauci
Posts: 2
Joined: Tue 07 Dec 2010 04:43

Post by nomauci » Wed 08 Dec 2010 04:40

Maybe only in old version.
I install MySQL Database in my development computer(5.1.52-community)
and run program in local is ok.
Only found when connect to server(4.1.7-nt)

Devart.Data.dll 5.0.159.0
Devart.Data.MySql.dll 6.0.58.0

I test with these code...

using LinkerContext;

namespace test
{
class Program
{
static void Main(string[] args)
{
//LinkerDataContext DC = new LinkerDataContext(@"User Id=root;Password=lim;Host=127.0.0.1;Database=tpoker;");//ok
LinkerDataContext DC = new LinkerDataContext();//error

foreach (var item in DC.Paysys_machines)
{
item.IsOnLine = !item.IsOnLine;//just for test
}

DC.SubmitChanges();//error here
}
}
}

error:
Devart.Data.Linq.ChangeConflictException was unhandled
Message="Row not found or changed."
Source="Devart.Data.Linq"
StackTrace:
於 Devart.Data.Linq.y.a(DataContext A_0, ConflictMode A_1)
於 Devart.Data.Linq.y.b(DataContext A_0, ConflictMode A_1)
於 Devart.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
於 Devart.Data.Linq.DataContext.SubmitChanges()
於 test.Program.Main(String[] args) 於 test\Program.cs: 行 21
於 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
於 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
於 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
於 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
於 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
於 System.Threading.ThreadHelper.ThreadStart()
InnerException:

Table:
# Database: tpoker
# Table: 'paysys_machine'
#
CREATE TABLE `paysys_machine` (
`id` int(10) unsigned NOT NULL auto_increment,
`LocID` int(10) unsigned NOT NULL default '0',
`IP` varchar(20) NOT NULL default '0000',
`MAC` varchar(20) NOT NULL default '00-00-00-00-00-00',
`Game` varchar(100) NOT NULL default '',
`isOnLine` tinyint(1) NOT NULL default '0',
`isWarning` tinyint(1) NOT NULL default '0',
`isLocked` tinyint(1) NOT NULL default '0',
`CurrentCredits` int(10) unsigned NOT NULL default '0',
`TodayIn` int(10) unsigned NOT NULL default '0',
`TodayOut` int(10) unsigned NOT NULL default '0',
`isError` tinyint(1) NOT NULL default '0',
`Error_code` int(11) NOT NULL default '0',
`LastOn` datetime default '0000-00-00 00:00:00',
`LastOff` datetime default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Wed 08 Dec 2010 17:20

Could you please specify the SQL command that is generated for this update? You can check it with the LinqMonitor component and dbMonitor application; for the details on how to use them, please refer to
http://www.devart.com/linqconnect/docs/LinqMonitor.html
http://www.devart.com/linqconnect/docs/dbMonitor.html

Also, please specify the data from the row with which the issue occurs. We couldn't reproduce the problem in our environment.

killswtch
Posts: 9
Joined: Sat 18 Dec 2010 16:58

Post by killswtch » Wed 12 Jan 2011 21:21

This problem also seems to be occuring for the SQLite version of dotConnect. I'll provide an example when I have time. For the moment I'm just not updating the datetime fields.

killswtch
Posts: 9
Joined: Sat 18 Dec 2010 16:58

Post by killswtch » Wed 12 Jan 2011 22:15

Actually, it seems that it was a very tricky error caused by a workaround for another error.

Post Reply