FLEX - How to close a db file in flex so it is then free to be overwritten?
In flex I have an air app using a local database called mydb.db. In the app I have an option to open a new database. When the user clicks open they then browse and select the db file they wish to open.
The app then copies the selected database file to its local directory and I want it to overwrite the database file it is currently using in this directory with the new db file of the same name.
Problem is it throws an error when overwriting the file using the file.copyto method - even with the overwrite parameter set to true, i believe this is 开发者_开发问答because the file is currently in use by the flex application itself and hence locked, so my question is how can i close this db file and free it so that i can then overwrite it with the new db file.
Have you still got an open SQLConnection to the DB? You'll probably need to close that first.
You haven't explicitly mentioned how you're connecting to the database. If you're using SQLConnection
to connect, look at SQLConnection.close
.
Otherwise, update your question with an example of how you open the database and how you're currently trying to close it.
I fixed it - turned out I had multiple connections (in other class constructors) to the same database so had to close them all.
精彩评论