×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    May 2013
    Posts
    270

    How to fetch records after deleting from rms?

    I am working on s40 apps and creating rms database. I added data to the database and after adding i m deleting some records.

    So whenever i am reading that database to fetch records i am getting exception javax.microedition.rms.InvalidRecordIDException. I know we cnt use record id that is deleted. So how can i get all the valid records(records which have data) of the database since in between many id might be deleted?

  2. #2
    Nokia Developer Champion
    Join Date
    Mar 2013
    Posts
    602

    Re: How to fetch records after deleting from rms?

    i suggest you keep a seperate version of your records ID (and either save them at a predefined record 0 or a new seperate recordstore)
    and everytime you add/delete a record to your DB, then update the records ID list and save them.

  3. #3
    Registered User
    Join Date
    May 2013
    Posts
    270

    Re: How to fetch records after deleting from rms?

    okhay ! thanks

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,567

    Re: How to fetch records after deleting from rms?

    Actually RecordStore.enumerateRecords is invented for this purpose.

  5. #5
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: How to fetch records after deleting from rms?

    You can use RecordStore.enumerateRecords to get the list all available records in the recordstore but if you wish to have direct access to the record store using record ID - then you will have to either maintain a record id list or put a try/catch to catch the InvalidRecordIDException exception and ignore it - as you know that this record is deleted.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  6. #6
    Regular Contributor
    Join Date
    Dec 2012
    Location
    Indonesia,DKI Jakarta
    Posts
    87

    Re: How to fetch records after deleting from rms?

    Quote Originally Posted by Manpreet_Singh View Post
    I am working on s40 apps and creating rms database. I added data to the database and after adding i m deleting some records.

    So whenever i am reading that database to fetch records i am getting exception javax.microedition.rms.InvalidRecordIDException. I know we cnt use record id that is deleted. So how can i get all the valid records(records which have data) of the database since in between many id might be deleted?
    Hi Manpreet,

    Use this:
    Code:
    try
    {
    RecordStore rs = RecordStore.openRecordStore(recordStoreName, true);
    RecordEnumeration re = rsRoomContact.enumerateRecords(null,
    						null, false);
      if (re.numRecords() > 0)
      {
              while (re.hasNextElement())
    	  {
    
    		int recordId = re.nextRecordId();
    		String raw = new String(rsRoomContact.getRecord(recordId));
                    System.out.println("###RAW### "+raw);
              }
       }
    }
    catch()
    {
    }
    Hope this help



    Iqbal
    Last edited by muhamad.iqbal; 2013-08-02 at 04:53.

Similar Threads

  1. Replies: 4
    Last Post: 2013-03-14, 14:10
  2. How to fetch records from recordstore to append on canvas
    By j.wawdhane in forum Mobile Java General
    Replies: 1
    Last Post: 2009-10-27, 12:30
  3. RMS questions -- updating and deleting records
    By earamsey in forum Mobile Java General
    Replies: 1
    Last Post: 2007-09-18, 18:16
  4. nokia 3410 - problem with deleting records from a recordstore
    By tillstoschus in forum Mobile Java General
    Replies: 0
    Last Post: 2002-11-11, 21:24
  5. deleting records with asp and wml
    By Nokia_Archive in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2002-05-15, 20:48

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •