'Starter:
Sub Process_Globals
'...
Dim RP As RuntimePermissions
Dim SafeFolder
'....
end sub
Sub Service_Create
'...
SafeFolder=RP.GetSafeDirDefaultExternal("")
'...
end sub
'In Main
Sub Process_Globals
'...
Dim KVS As KeyValueStore
'....
end sub
Sub Activity_Create(FirstTime As Boolean)
StoreFolder=Starter.safeFolder
If FirstTime Then
KVS.Initialize(StoreFolder ,"kvs")
End If
end sub
'KeyValueStore:
'Initializes the store and sets the store file.
Public Sub Initialize (Dir As String, FileName As String)
If sql1.IsInitialized Then sql1.Close
'This line raises the exception
sql1.Initialize(Dir, FileName, True)
CreateTable
End Sub