zzk
New Member
Posts: 2
|
Post by zzk on Apr 23, 2021 4:41:26 GMT
Dear all, I am facing a problem when I try to delete the database using Directory.Delete() from System.IO . After searching online and using tools such as process explorer, it is likely that the problem lies in the SQLManager that is accessing the .db file. However, even after deleting the game object in unity that holds the SimpleSQLManager component, the database seems to be still accessed by it and I couldn't delete it. I can't be sure if the problem is 100% due to simpleSQLManager but I would like to ask if there is a method/way for me to stop the SQLManager from accessing the database. Thank you!!
Update: I have successfully solved the problem by using the Close() method. I would like to ask if there is a way to reopen the SQLManger after the closed, or should I create another simpleSQLManager component?
|
|
|
Post by echo17 on Apr 23, 2021 9:44:33 GMT
Before doing file operations on the database file, try closing and disposing your SimpleSQLManager object.
So if you have your manager defined like:
public SimpleSQLManager dbManager;
Then you can call:
dbManager.Close(); dbManager.Dispose();
|
|
zzk
New Member
Posts: 2
|
Post by zzk on Apr 23, 2021 9:55:17 GMT
Thx for the reply, I have successfully solved the problem! I would also like to ask if there is a way to reopen the SQLManger after the closed, or should I create another simpleSQLManager component?
|
|
|
Post by echo17 on Apr 24, 2021 12:57:01 GMT
You can use the Initialize method to reconnect to a database file. See these FAQs for more information: linklink
|
|