Eddies Electronics Desktop Example Not Saving Data

I am new to Xojo. I would like to develop a database application modeled after the Eddies Electronics Desktop example that ships with Xojo. My problem is that when you run the Eddies Electronics application and enter data, such as new invoices, that data is not saved when you quit the app and restart it again. My question is, how do I modify the program so that the data that is entered is permanently saved to the database?

Hi John,
and welcome to Xojo. The Eddie’s Electronics demo uses a fresh database each time it is run via the project’s copybuild step. Usually you will have a database somewhere on your desktop computer or on a web server. The documentation’s entries on folderitem and database itself should give you an idea how to connect to en external database and how to choose the appropriate location. The using SQLite databases tutorial may help too.

The changes are saved. If you build a standalone app, you’ll see the changes are saved when you run the app again.

However, when you run from the Xojo IDE, a new copy of the database is copied alongside the app (overwriting anything that was there). This is why your changes don’t appear to be saved.

To change this behavior, put the DB file in a common location and then use it instead.

Follow these steps to modify Eddie’s Electronics so that you can retain the data between runs:

  1. Copy the database file to a your Documents folder so it can be easily referenced.

  2. Remove the Copy File Build Step. Click on your platform in Build Settings (OS X, Windows, Linux) and expand it. Then click on the Copy File Step and delete it.

  3. Change this line in the SetupNewDatabase Shared Method in OrdersDatabase:

Dim sourceDB As FolderItem = GetFolderItem("EddiesElectronics.sqlite")

To this:

Dim sourceDB As FolderItem = SpecialFolder.Documents.Child("EddiesElectronics.sqlite")

That should do it. Now when you run, the DB in the Documents folder will be used each time, so you’ll see the changes you’ve made.

Thank you Paul. It works perfect now!