First, I'm on Xojo 2017r3. I'm following the instructions here to set up a simple 1-table database to store information from a dictionary. This tutorial was clearly made with a different version of the IDE, but I was able to figure it out and make the database. I see it in the left column of the IDE. Note that I don't care if this database is persistent - it's meant to be a temporary place to compile the records before exporting a report. It'd be fine as an in-memory database (which is what I've just set up, right?)
I have a Module with a single property:
db as database so that it's global.
In my App, I have an Open Event Handler that opens the database,
db = ManifestReports if db = Nil then MsgBox "Manifest Report DB not found" end if
This works - or at least, it doesn't fail.
My app traverses a folder and gathers metadata about the files it contains, putting each file's metadata into a dictionary (
mediaItem) . When that's done, it's supposed to add a row to the database, one for each file:
dim r as DatabaseRecord r = new DatabaseRecord //loop through the dictionary that holds the metadata for this file //and set it up to be added to the database for each key As Variant In mediaItem.Keys dim field as string = key r.column(field) = mediaItem.value(key) next //connect to and add the metadata to the database If db.Connect Then db.InsertRecord("mediaInfo", r) else msgBox db.errormessage end if //display any errors if db.error then msgBox db.errormessage end if
However, it's never connecting to the database. The error message it's giving is that there is no error message, but
db.Connect is somehow failing.
Am I missing something fundamental here?