Database file open problem

I’m working on a program that involves two computers sharing database information across a distance. I have the same program in both computers so that I can save the database table and then e-mail it to my friend. I’ve named the table “InfoIn.rsd” with the idea that my friend then “copies and paste” the rsd file to a preset location and his program then opens the file which is in the identical position. Basically what I have is a standard database file and I use the “SELECT * FROM INFOIN” to open the file and populate a list box.

The problem is, the program doesn’t seem to see the “InfoIn.rsd” file. (I am using two computers to check the code and simulate distance. I also clean the InfoIn.rsd file after each use on the receiving computer to simulate a new file received.) Is this because althought the database tables are defined in both computers, the file is still seen as an external file? I’ve checked the code and it all looks good; and the program will run, the PopulateListBox function shows the correct column names and all but the list box will not load. Has anyone else had this problem and if so, could you give me some hints on how to correct the problem. Thank you.

How are you opening the database? With GetFolderItem(pathtofile), or did you drag the file into the project and you’re letting Xojo open it for you?

Pardon the delay: I’m also the cook going into the evening. I have a SpecialFolder.Child(“InfoIn”) in both programs. The database in Apps Open is written to that address. The program saved the database table to the SpecialFolder.Child(“InfoIn”) in computer A. I then go into documents and copy and paste the database to a memory stick and then go to computer B and delete the old “InfoIn” file and replace it with the just copied “InfoIn” database. From there I have commands UpdateInfoInLB and PopulateInfoInListBox toshow the database. My thinking was that if the database file is saved to an identical file in computer A it could be opened in computer B as the program would have no way of knowing it had been “imported”.

I have other database tables that work perfectly but the tables are not copied, pasted and deleted as the “InfoIn” table is. I suspect that somehow the program detects that the table has been inserted and is thereofre not connected so to speak. IF this is correct then where can I find the work around? Thank you for taking the time to help me.

Just a thought… Do you close the database/program on computer A before copying?
New data isn’t always immediately written to the main file, sometimes it waits until the next query or update.
It could still be sitting in a journal file next to the main database, while the main file is still ‘empty’.

Tried closing program had no effect. I’m wondering how the program would know one “InfoIn” table had been deleted and a second table of equal specifications but different content added to the Documents section of the computer. What I’m uncertain of is how to connect an external table to a program and read it. Would you know of an example of doing this as I’m more than willing to give it a try. Thank you.

So you’re saying that the problem is that the file itself is found, but the program is displaying obsolete data?

If the program is open when you copy the file (on either machine), then you could be missing data that either hasn’t been flushed to the file (machine A) or is hidden because the file is already cached in memory (machine B). Close the program on both machines when you copy the file.

Another possibility is that your program is actually reading the file from somewhere else. That file isn’t changing, so you don’t see your updated data. To test that, delete the file on machine B and try to start the program. If you see data, then you’re not working with the right file.

I’ll give that a try. May be tomorrow before I have an answer but will try to post a response by nine am EST. Thank you.

Turns out what I was attempting does work. Problem appears to be in having used two computers to develop the code in that I worked the problem through on one machine only so everything worked correctly. Then carried the file to the second computer where it wouldn’t work. The problem appears to be that I was correcting both codes but wasn’t as careful as needed in watching which I was correcting so that I was in effect working against myself.

It works now. Tim and John, I appreciate your help. Thank you.