Here's the scenario:
The application already had a SQLConnection open to a SQLite database, and it was open syncronously in READ mode. I wanted to write some data into the same database, so decided to close the connection, reopen it, now in UPDATE mode. That way, I can write data, and keep the connection open so that the rest of the code can continue using the connection as well.
This is what I did:
- I issued a conn.close();
- I did a trace(conn.connected) //to check if the connection is closed
- And finally, a conn = null; // just in case ;)
Now let me get it straight. I was executing the command in the SQLConnection open event handler. And the error said the connection is closed ??
After spending a good chunk of time trying to investigate it, adding a responder to the conn.close() call, and creating a new connection object after that responder was triggered, solved the problem.
Wonder why, being a synchronous connection still had something running in the background, when my code had moved on to create the new connection, and open it as well.
Guess its one of those things...
Post a Comment