Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6253613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:01:57+00:00 2026-05-24T14:01:57+00:00

I create a List showing data from a RecordStore. I tried to update a

  • 0

I create a List showing data from a RecordStore. I tried to update a record and the re-display the list (re-open the same RecordStore), but the updated item doesn’t change (still contain the old data).
I also tried to delete an item and the deleted item is still displayed in the list.
I run the program using emulator from NetBeans 7.0 with Java ME SDK 3.0

This is the code for updating the record

public void updateClient(Client cl) throws Exception{
        RecordStore rs=RecordStore.openRecordStore(String.valueOf(clientsStoreKey), true);
        int recNum=rs.getNumRecords();
        if (recNum>0){
            RecordEnumeration renum=rs.enumerateRecords(null, null,false);
            while(renum.hasNextElement()){
                int id = renum.nextRecordId();
                byte[] buff=rs.getRecord(id);
                Client temp=Client.createFrom(buff);
                if(temp.clientId.compareTo(cl.clientId)==0){  
                    temp.firstName=cl.firstName;
                    temp.lastName=cl.lastName;
                    temp.city=cl.city;
                    temp.state=cl.state;
                    temp.company=cl.company;
                    temp.phone=cl.phone;
                    ByteArrayOutputStream bos=new ByteArrayOutputStream();
                    DataOutputStream dos=new DataOutputStream(bos);
                    temp.writeTo(dos);
                    byte[] sData=bos.toByteArray();                  
                    rs.setRecord(id, sData, 0, sData.length);
                    dos.close();
                    bos.close();  
                    break;
                }
            }
            renum.destroy();
        }
        rs.closeRecordStore();       

    }  

And this is the code to get the records

public Vector getClients()
    throws Exception{

        RecordStore rs=RecordStore.openRecordStore(String.valueOf(clientsStoreKey), true);
        int recNum=rs.getNumRecords();
        Vector cls=new Vector();

        if (recNum>0){
            RecordEnumeration renum=rs.enumerateRecords(null, null,false);
            while(renum.hasNextElement()){
                byte[] buff=renum.nextRecord();
                Client cl=Client.createFrom(buff);
                cls.addElement(cl);
            }
            renum.destroy();
        }
        rs.closeRecordStore();
        return cls;
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:01:58+00:00Added an answer on May 24, 2026 at 2:01 pm

    interesting – your code dealing with record store looks rather OK to me. Is there a chance for some glitch in UI – like say using old or incorrectly updated screen object?

    How do you debug your application? Since you mention emulator, System.out/println looks like a natural choice doesn’t it? I’d use it to output content of the record right after setting it in updateClient and after getting it in getClients

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a list of integers from 1 to n . I
I want to create a list of lambda objects from a list of constants
Trying to create a list to return some JSON data to a view. Following
I haven't used repeaters for much more than showing data from a datatable. I
I have created a unbound listbox. I have the box showing a list of
I am using the following css to create list items with a chckerboard background
I want to create a list of columns in SQL Server 2005 that have
I want to create a list of methods to execute. Each method has the
I want to create a List of KeyValuePair s in a managed C++ project.
How can I create a list in C++? I need it to create a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.