Commands out of sync; You can't run this command now

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
sabbir
Posts: 17
Joined: Tue 02 Dec 2014 09:45

Commands out of sync; You can't run this command now

Post by sabbir » Fri 09 Jan 2015 12:44

hi,
i was using dotConnect Pro for MySQL 7.2.77 with visual studio 2010 for Devart Entity Model.
it was working well.When i shift to windows8.1,visual studio 2013 and dotConnect Pro for MySQL 8.303, i get 'Commands out of sync; You can't run this command now' error to access navigation property.i didn't change anything in code,just Update & recreate the model.

What can be the problem?Please let me know.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Commands out of sync; You can't run this command now

Post by Shalex » Mon 12 Jan 2015 09:12

Could you please localize the problem and send us a small test project so that we reproduce the issue in our environment?

JIC
This exception originates from ADO.NET level and has two possible reasons:
1. Usage of a single connection in multiple threads. In order to avoid the "Commands out of sync; You can't run this command now" exception, a separate connection should be employed in each thread.
2. MySqlDataReader is not closed or read completely. The exception can occur, for example, if another exception occurred when reading data via MySqlDataReader, and it was caught and processed, but MySqlDataReader was not closed. In order to avoid the "Commands out of sync; You can't run this command now" exception, the MySqlDataReader objects should be used inside a using block.

sabbir
Posts: 17
Joined: Tue 02 Dec 2014 09:45

Re: Commands out of sync; You can't run this command now

Post by sabbir » Mon 19 Jan 2015 09:17

thanks for the reply.I've no test project now in my hand.i got the problem in my live project and solve it.i can describe the scenario.

My project was in vs2010 with .net framework 3.5 and MVC 3.My OfficeModel.edml was created using EntityFramwork version 4.x with Devart.Data.MySql.Entity.dll version 7.2.77.0.Working well.i updated to .net framework 4 and MVC 4 before few months with existing devart,visual studio and EntityFramwork version.Before few days,i shift to visual studio 13 and Devart.Data.MySql.Entity.dll 8.3.313.0.i didn't update EntityFramwork 4.x from .edml file,didn't update EntityFramwork & didn't update .net framework.so when it executes the navigation property,it show the error "Commands out of sync; You can't run this command now"

After testing with many combination,finally i was able to fix the issue.First i update .net framework 4 to 4.5, update Devart.Data.MySql.Entity.dll version 8.3.313.0 to 8.3.313.6,update EntityFramework 4.x to 6.00.Recreate the model(.edml) using EntityFramework 6.00.it working now.

it is better to have a page describing the combination of different dlls

thanks

Post Reply