I have written my program on a Mac platform and its run very well.
The Program and the data base are in the same directory.
Now I like to run it on Windows 7. A have copy the program and de DataBase also in the same directory in a Windows folder, but its dont run. There is always an error like: Database file doesnt in exist in the specified location
Dim DbFile as FolderItem
dbFile = GetFolderItem("Bestellingen.sqlite")
if DbFile <> NIL then
DBase=new SQLiteDatabase
DBase.DatabaseFile = dbFile
DBase.MultiUser=True
if DBase.Connect then
Return True
Else
MsgBox("DataBase kan niet geopend worden. fout: " + DBase.ErrorMessage)
Return False
End If
End If
Whats wrong ??
Ik heb het volgende geschreven, maar het funktioneerd niet, fout melding.
Dim DbFile as FolderItem
Dim FileNaam As String
FileNaam="Bestellingen.sqlite"
DbFile = Specialfolder.CurrentWorkingDirectory.NativePath + FileNaam
if DbFile <> NIL then
DBase=new SQLiteDatabase
DBase.DatabaseFile = dbFile
DBase.MultiUser=True
if DBase.Connect then
Return True
Else
MsgBox("DataBase kan niet geopend worden. fout: " + DBase.ErrorMessage)
Return False
End If
End If
DbFile = Specialfolder.CurrentWorkingDirectory.Child(FileNaam)
would be better as it is xPlat, however on Windows current working directory is probably not writable. You might like to try Specialfolder.ApplicationData.
Hi Hans, als het databestand nog niet bestaat, dan moet het eerst worden aangemaakt.
Ik heb je code even werkend gemaakt:
[code] Dim DBase As SQLiteDatabase
Dim FileNaam As String = “Bestellingen.sqlite”
Dim Pad As String = Specialfolder.CurrentWorkingDirectory.NativePath + FileNaam
MsgBox Pad
Dim DbFile As New FolderItem(Pad,3)
If DbFile <> Nil Then
DBase = New SQLiteDatabase
DBase.DatabaseFile = DbFile
DBase.MultiUser=True
// als het databestand niet bestaat, dan moet het hier worden aangemaakt
// -----------------------------------------------------------------------------------
If DBase.CreateDatabaseFile Then
// indien het bestand nog niet bestaat, dan wordt het nu aangemaakt.
// in dat geval moet je wel nog je tabellen etc. aanmaken nadat je verbonden bent.
End If
// -----------------------------------------------------------------------------------
If DBase.Connect Then
MsgBox("Database verbonden")
Else
MsgBox("DataBase kan niet geopend worden. fout: " + DBase.ErrorMessage)
End If
Hi Joost,
Ook met de laatste code komt dezelfde fout melding, als ik een nieuwe DataBase maak of de oude gebruik.
Ik heb allerdings nog geen build license, kan dat mischien van invloed zijn?
Every thing is still working under mac Open, read and close the database.
But by windows 7 the program cant find the database.
Always the database is in the same folder as the program, on the windows platform and by Mac.
The Code is:
Dim DbFile as FolderItem
dbFile = GetFolderItem("Bestellingen.sqlite")
if DbFile <> NIL then
DBase=new SQLiteDatabase
DBase.DatabaseFile = dbFile
DBase.MultiUser=True
if DBase.Connect then
Return True
Else
MsgBox("DataBase kan niet geopend worden. fout: " + DBase.ErrorMessage)
Return False
End If
End If
By Mac it’s works.
By Windows there is an error like:
Database file doesnt in exist in the specified location
Also if a changed the code in:
Dim DbFile as FolderItem
Dim FileNaam As String
FileNaam="Bestellingen.sqlite"
DbFile = Specialfolder.CurrentWorkingDirectory.Child(FileNaam)
Im am working with a version without a build license, only the debugger.
You know how the debugger works I guess. Well, open a new empty project and copy the above code in the App.Open eventhandler and put a breakpoint on the verry first line. Walk thrue the code, line by line and tell us in which line you get an error and what the error-description is.
I tested my code in Windows 7, no problem ,
BTW: I use SQLite, MySQL and PostgreSQL in my desktop applications for Windows and Mac , the user of my application can chose at first start what he wants to use.