List:General Discussion« Previous MessageNext Message »
From:Jani Tolonen Date:October 8 2001 8:06am
Subject:Commands out of sync: You can't run this command now.
View as plain text  
?= writes:
 > Hi all.
 > Let's assume the function Foo lke below.
 > void Foo()
 > {
 > 	dbGetMaxNo();
 > 	dbInsert();
 > }
 > dbGetMaxNo returns maximum number of a certain column and dbInsert inserts
 > just one row in table.
 > These tow functions access same table and use same DB connection.
 > dbGetMaxNo() is executed successfully.
 > But when execute dbInsert() there occurs an error that is "Commands out of
 > sync: You can't run this command now."
 > What's wrong with this?
 > Please tell me the answer.
 > Thanks in advance!


Two possibilities:


You may be experiencing problems from possible mix of two different
MySQL installations. Please check what version (and the date) of
files 'mysql.h' and 'libmysqlclient.a' your client is using. They
must be from the same MySQL installation. If they are not, please
recompile your client using the correct files.


Please check your client code, you may be calling client functions in
wrong order, for example:

when using mysql_use_result(), you must execute mysql_fetch_row()
until a NULL value is returned, otherwise the unfetched rows will be
returned as part of the result set for your next query, which will
result in the error.

Or it can happen, for example, if you are using mysql_use_result() and
try to execute a new query before you have called
mysql_free_result(). It can also happen if you try to execute two
queries that return data without a mysql_use_result() or
mysql_store_result() in between.

Please consult the documentation of the client functions that you are


- Jani

For technical support contracts, visit
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Mr. Jani Tolonen <jani@stripped>
 / /|_/ / // /\ \/ /_/ / /__   MySQL AB, Full-Time Developer
/_/  /_/\_, /___/\___\_\___/   Helsinki, Finland
Commands out of sync: You can't run this command now.심충보7 Oct
  • Commands out of sync: You can't run this command now.Jani Tolonen8 Oct