0

Hello,
I have developed application in NetBeans using VMD, which add, edit, view and delete record using RecordStore. I can successfully add and view RecordStore. I am finding difficulty to Edit/Delete Record.
To Edit(Update)/Delete, I maintained new form, used ChoiceGroup.Popup, which retrieve IDs from Record-Store. Here what I am getting problem. Popup can show IDs of stored Records. But when I am Inserting Record and then immediately go To Edit/Delete Form, Pop-up is not showing that added ID. But When I press END button of emulator and start again application, that newly added record can be seen.
Here Code Which I used to retrieve IDs in Popup.

try {
            RecordEnumeration renum = rms.enumerateRecords(null, null, false); //rms is RecordStore object.
            int id;
            while (renum.hasPreviousElement()) {
                id = renum.previousRecordId();
                cg.append(String.valueOf(id), null);
            }
            
        } catch (Exception e) {
        }
2
Contributors
8
Replies
9
Views
7 Years
Discussion Span
Last Post by Hakoo
0

That code is OK. My best guess will be that you either didn't close RecordStore properly or by some mistake you reusing original store before insert of new record. You can find work RecordStore application example hereto compare ideas/solutions

0

Hello,
Even I thought same that recordStore is not opening/close properly. So, I made openRMS() and closeRMS() which Open and Close it properly. And applied, then I was not able to see data, don't know what's happening??
I am feeling J2ME is so limited useful, Can I use anything else, instead of that?

0

OK, I am working in company, is it ok, if I expose Company's code on this forum? Its not a big project that I developed, but still its about rules and regulations. Can you advise me for alternative or further advance of RecordStore?

0

Well the question of code is for you to discus with your colleagues/superior, each company has different policies. For example I'm working for open source company so I'm actually encouraged to share with, where people working for financial institutions and government cannot and therefore usually post snippets usually with some mock service.
If you trust me you can send me by PM your whole mobile project so I can have look at it. However no promises on speed and solution

0

I put openRMS() method in constructor and the problem is solved.

0

Well if that worked for you as quick-fix why not. Nevertheless you should look into it once you have time because it is not best coding practice

0

Yeah, proper Opening and Closing of Record Store are most important. "Initialize Lazy" feature of NetBeans creates problem for use object some how. So, have to put OpenRMS() method in Constructor, so it can be accessible. Any how, now I am little bit familiar with NetBeans and VMD tool. So this is not a problem for me.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.