4 Replies Latest reply on Oct 12, 2006 4:13 PM by nevereasy

    database

    nevereasy Level 1
      Hi great ones!!!
      I'm really proud of my progress so far, but I need someone to pull this to pieces for me. It is doing some very strange things.
      For example, for no know reason it creates a new database (property list) inside the original one. I can't catch the moment when this happens. The database is saved to an external file called "NRT_data.txt"

      The other problem I still have is that it won't delete the first record. I do need it to empty the whole list.

      I would be happy to email anyone the complete .dir movie and the data file if you think you could help me.
      The active code is all in the movie script ... hopefully it will be attached.
      Of course I will be very greatful to any help, and I will acknowledge it in the comments on the code!!
      thanks,
      Carmel.

      This is a copy of the contents of the NRT_data.txt at this stage:
      [[#FirstName: "1", #LastName: "1", #Password: "1", #email: "1"], [#FirstName: "2", #LastName: "2", #Password: "2", #email: "2"], [#FirstName: "3", #LastName: "3", #Password: "3", #email: "3"], [#FirstName: "4", #LastName: "4", #Password: "4", #email: "4"]] [#FirstName: "", #LastName: "", #Password: "", #email: ""]]", #email: "6"], [#FirstName: "7", #LastName: "7", #Password: "7", #email: "7"], [#FirstName: "8", #LastName: "8", #Password: "8", #email: "8"]] [#FirstName: "8", #LastName: "8", #Password: "8", #email: "8"]]]

        • 1. Re: database
          duckets Level 1

          Could it be that your fileio operations in your saveDatabase handler aren't clearing the remainder contents of the file before writing? I don't use fileIO a lot, but I remember when I did that there was an issue if you re-write a file with a shorter string than the original, the remainder portion of the original file remains at the end. I beleive I had to actually delete the file before creating and re-writing a shorter amount of data into it to solve the problem.

          hope this helps!

          - Ben
          • 2. Re: database
            nevereasy Level 1
            Thanks for this Ben. Deleting the file before saving to it works well.

            Now I have one more problem: why can't I delete the first record? I feel as if there are some real errors in my code.
            • 3. Re: database
              duckets Level 1
              Probably something to do with the way your database tries to move to the previous record when one is deleted. What error is it giving?

              And to be honest, that looks like a hell of a lot of code just to manage some names, emails and passwords! - what is it that your app does?
              • 4. Re: database
                nevereasy Level 1
                So far .... this code will (should?) allow a user to register with 4 fields and login searching for 2 of them. And an administrator to browse, search and edit the data. And the program automatically saves it all to an external text file, and keeps that file updated all the time.

                It will get worse:
                In the finished program I want this data linked to a list of movies that a user has visited ... and then also to record their results in tests that they do.

                When the program doesn't delete the first record, it doesn't give me any error message. The reason it moves to the previous record is because if it doesn't move away from this record, then it will save it again when the user leaves it in whatever way (ie going 'next' or 'home' .... all designed to save what is on screen .. even blank fields will be saved)
                When it is not deleted it doesn't show an error. It looks like it is gone, because the screen shows the previous record, (which, if it is the first record, will be the last record, because it loops - I think you're right the problem is here somehow?) But when I hit the next button, it is still there. For all the other records other than No 1, it works very well, they are really wiped from the list.

                thanks for your interest, I hope you can help.
                this is an English literacy program ... some of which can be seen at:
                www.nowreadthis.com.au