[MySQL Connector] Error "There is already an open DataReader associated..."

[MySQL Connector] Error "There is already an open DataReader associated..."

  
Forge Component
(16)
Published on 2013-02-21 by Rúben Gonçalves
16 votes
Published on 2013-02-21 by Rúben Gonçalves
Hello.
Full error message is "There is already an open DataReader associated with this Connection which must be closed first."
When you get this error most likely there is nothing wrong with the connections, but an error with the SQL query you are trying to execute, most likely a conversion error of certain data type.
---
SOLUTION: Review your query!
---
For example, MySQL uses the value '000-00-00' for the "zero" date. We must convert this value to a valid outsystems date, something like this:
(...)
CASE tx.creation_date = '0000-00-00' THEN NULL ELSE tx.creation_date END,
(...)

Hope this helps anyone and saves them of spending several hours trying to figure out what's the problem.