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

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
[email protected]
Posts: 12
Joined: Tue 11 Oct 2005 14:03

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

Post by [email protected] » Wed 03 Oct 2012 20:45

i ve go delphi xe and mydac 7.2.8 and iv got a :Tmyquery : select * from matable where myindex = toto in a table that is not big 2000 or 3000 record but this Tmyquery is really often call by my software and i ve got the error 'Commands out of sync; You can't run this command now'

why

the code
Txat2.Close;
Txat2.ParamByName('session_id').Value:=sessionid;
Txat2.Execute;
if Txat2.RecordCount >0 then .....

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

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

Post by AlexP » Thu 04 Oct 2012 08:57

hello,

There are many possible reasons for this error. It is possible if you're executing more than one SELECT query in one dataset.
Please describe in more details the whole case where the error occurs.

[email protected]
Posts: 12
Joined: Tue 11 Oct 2005 14:03

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

Post by [email protected] » Thu 04 Oct 2012 10:38

Hello,
i ve got a Twebmodule who is waiting to receive xml file when an xml file arrive it start a procedure that search informations and iv got the problem when 2 simultaneous xml file arrive in the webmodule and launch the procedure who is not finished

AndreyZ

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

Post by AndreyZ » Mon 08 Oct 2012 09:41

The "Commands out of sync; You can't run this command now" error occurs in this case because you are trying to execute several commands through one connection. To solve the problem, you should create the TMyConnection and TMyQuery components dynamically in your procedure. This way, each call of your procedure will work with its own components and there will be no simultaneous command calls through one connection.

Post Reply