We are using a REALSQLdatabase in a program and want to load a different database and delete the previous file. I keep getting a 104 error on the delete even after loading a different database file. How to stop the previous file from being “in use”?
why are you getting “an avalanche of database errors”?
nothing is accessing either database in that scant fraction of a second that that connection switches…
Right That was my point. I had to reconnect in the same method that deleted the file before leaving the method. That method had gone to another to get the user’s confirmation on the deletion, which went to another to get the database name. I put a separate confirmation dialog in the first function so we don’t try to access the database while it’s closed.
Ah, my first go at answering a question, don’t know if I am right or wrong but I use a button with the following code and it works well.
[code] dim result as integer
result = msgbox (“Are You Sure you want to DELETE the DATABASE ?”,36)
if result=6 then
app.golfer.close
Dim f as Folderitem
f=SpecialFolder.ApplicationData.Child(“TGC”).Child(“Golf”).Child(“golfer.rsd”)
f.Delete()
If f.LastErrorCode > 0 then
MsgBox Str(f.LastErrorCode)
Else
MsgBox “DataBase Deleted, Program must be Restarted to Create NEW Database”
window.close
End if
exit
end if[/code]
just so you know for sure that you’re accessing the right file. If you change the path or name later on, you don’t have to remember to update this code, too.