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

Hi all,

I have developed a web app that retrieves data based on a date period range. When I click the retrieve button first time, data is retrieved fine.
When I modify the date period and click the same button a second time I get the error:
2014 Commands out of sync; you can’t run this command now

When I refresh my url and try it again, it works fine.
Do I have to do anything about a session object? I am not really familiar with this in Xojo.

I also surfed around the internet and I read about the:
mysql_use_result(), mysql_free_result(), etc.

If anyone can help me out on this issue I would appreciate it.
Thank you.

The time that I usually see things like this is when users try to use the same database connection for all of their sessions. It works much better if you put the database instance property on the Session itself and then refer to it as Session.db.

MySQL needs to be handled in right order.
e.g. you first query, than you get data from records.
So maybe you need to make sure the old RecordSet goes out of scope, before you query again.

Hi Greg and Christian,

Thank you for the feedback.
I will get to it as soon as possible and post the result.

Take care.

I learned to Nil any existing reference to a RecordSet before submitting a new Query the hard way also - even after learning to use a per-session connection.