Put program and database on flash drive

I need to be able to put an executable program and a small database on a flash drive. I am at a loss on how to do this.
Incidentally, I have the program and database on my desktop computer but I need it to be copied to a flash drive.
I have not been doing much coding over the last few years so any help is appreciated.

Assuming that you have everything in the same folder just click and drag it to the flash drive.

Everything is not in the same folder. My executable is on my C drive and my database is on another drive. I copied the executable and the database to the flashdrive but that did not work.

99% sure that you just have the wrong path.
How are you getting the path to the db?

getfolderitem(".").child(“mydb.db”) might do it

Here is what I have coded

// Create Database Object
NameFileDB = New REALSQLDatabase

// Set Database File
NameFileDB.databaseFile = GetFolderItem(“NameFile.rsd”)

and have you

  • determined that the returned path actually points at the database file in question?

if it doesn’t, that is why it “doesn’t work”
if it does, then we need more information about what “doesn’t work”

Before I get to the database part I need to get an executable program on the flash drive. I copied the “.exe” and it wouldn’t run.

You need to copy everything in the build folder, not just the exe file. The libraries & resources are critical.

you need to define “won’t run”

  • nothing happens
  • you get an error message (if so WHAT is it)

You keep providing parts of the situation , but then contradict youself…
First you talk about the database
then you say the EXE won’t run

Lets take this one step at a time

And since you are saying “EXE” and not “APP” I assume its a WINDOWS deployment.
So yes as Wayne said, you need the whole build folder (as-is)… and assuming that you ARE NOT using the REGISTRY
as THAT information will NOT be on your flash drive

I should mention that I am using 2012 R1. What I just did was copy the entire 2012 folder to the flashdrive. I couldn’t find a “Build”
folder. I have used to "build icon to compile but I found no folder. Did I do it correctly by copying entire RealStudio folder?

are you talking about the folder where XOJO it self resides? then NO
What you need is the folder that the EXE was BUILT in…
And I don’t recall (I don’t usually use Windows), but sometime back then, was when it was switched from a single monolithic EXE to a Folder based one (per Microsoft)

So I’m gonna bow out of this conversation for now…

I apologize for my ignorance on this. I also appreciate all the help I am getting. I did find the “Builds folder” and copied it to flashdrive and the program worked. My remaining problem is my database. When I ran the program, it was empty.

Did you copy your database to the flash drive in the same folder as the executable file?

Hello Larry,

Maybe the following code put you in the good direction :

  // Create application path folderitem,
  // this is the path where your
  // application .exe path is located.
  Dim f_AppPath As FolderItem
  // Create a directory FolderItem,
  // which we will located in the 
  // same location as your exe file
  Dim f_MyDir As FolderItem
  // Name of directory
  Dim strDirName As String
  // Create a FolderItem which
  // will contain the reference
  // to the textfile we are gonna
  // create.
  Dim f_MyFile As FolderItem
  // Create a TextOutputStream
  // which we are gonna use to
  // create a simple textile.
  Dim tosWolf As TextOutputStream
  // Filename variable
  Dim strFileName As String
  // Actually get the path to your
  // applications .exe file.
  f_AppPath = GetFolderItem("")
  // Now f_AppPath contain the location
  // where your .exe file is located.
  // Here is the test to see where it is located :
  MsgBox "Path to the location where the exe file is located : " + f_AppPath.AbsolutePath
  // When you try to run this code in
  // the IDE, then you see the
  // temporary DebugBuild directory.
  // However, once you build an exe file
  // and then place that exe file in any
  // location on a flashdrive, harddisk,
  // doesn't matter, you always get the
  // location where your exe is stored.
  // By the way, this works on all
  // operating systems.
  // Now we are gonna create a directory
  // in the same location as your exe.
  // Name of directory to be created
  strDirName = "Wolf_Dir"
  // Store the path to the new directory "Wolf_Dir"
  // which still has to be created.
  f_MyDir = f_AppPath.Child(strDirName)
  // Now actually create the new directory
  // Showing the path to the directory just created
  MsgBox "Path to newly created directory : " + f_MyDir.AbsolutePath
  // Now to finish this example smoothly
  // we are gonna create a textfile
  // inside directory "Wolf_Dir".
  // Setting the filename
  strFileName = "Wolf_text.txt"
  // Setting the location and reference to our textfile
  f_MyFile = f_MyDir.Child(strFileName)
  // Creating the actual file
  tosWolf = TextOutputStream.Create(f_MyFile)
  // Just writing some example lines.
  tosWolf.WriteLine "This is an example made by Bad_Wolf"
  tosWolf.WriteLine "who is not so bad once you know him"
  // Before we close this file,
  // we are gonna check the location of the newly created file
  MsgBox "File path to textfile : " + f_MyFile.AbsolutePath
  // Close the textfile
  // The textfile code can be replaced by your database code

To test this code, just make a new project and copy the complete code to the
“open” event handler of your “app” class.

If you convert this code to your own application, you can move the directory containing your exe file wherever you want,
your database will follow, assuming that you place it relative to the location of your exe file.

Again, take in mind, on other operating systems, file extensions are different.

I hope this helps pointing you in the right direction.


I finally got it working. I truly appreciate all the advice I have received.