hi friends...
I have Written some codes for adding and retrieving data from RMS:

public void commandAction(Command command, Displayable displayable) {
        if(command==exit)
        {
            destroyApp(true);
            notifyDestroyed();
        }
        else if(command==start)
        {
            try
            {
                recordstore=RecordStore.openRecordStore("My RecordStore",true);
            }
            catch(Exception error)
            {
                alert=new Alert("Error Creating",error.toString(),null,AlertType.WARNING);
                alert.setTimeout(Alert.FOREVER);
                display.setCurrent(alert);
            }
            try
            {
                String outPutData[]={"Mary","Bob","Adam"};
                for(int x=0;x<3;x++)
                {
                byte[] byteOutPutData=outPutData[x].getBytes();
                recordstore.addRecord(byteOutPutData,0,byteOutPutData.length);
                }
            }
                
            catch(Exception error)
            {
                    alert=new Alert("Error Waiting",error.toString(),null,AlertType.WARNING);
                    alert.setTimeout(Alert.FOREVER);
                    display.setCurrent(alert);
            }
            try 
            {
                byte[] byteInputData=new byte[1];
                int length=0;
                for(int x=1;x<=recordstore.getNumRecords();x++)
                {
                    if(recordstore.getRecordSize(x)>byteInputData.length)
                    {
                        byteInputData=new byte[recordstore.getRecordSize(x)];
                    }
                    length=recordstore.getRecord(1,byteInputData,0);
                }
                alert = new Alert("Reading", new String(byteInputData, 0,length), null, AlertType.WARNING);
                alert.setTimeout(Alert.FOREVER);
                display.setCurrent(alert);
                
                
            }
            catch (Exception error)
            {
               alert = new Alert("Error Reading", error.toString(),null, AlertType.WARNING);
               alert.setTimeout(Alert.FOREVER);
               display.setCurrent(alert); 
            }
            try
            {
                recordstore.closeRecordStore();
            }
            catch (Exception error) 
            {
                alert = new Alert("Error Closing", error.toString(),null, AlertType.WARNING);
                alert.setTimeout(Alert.FOREVER);
                display.setCurrent(alert);
            }
            if (RecordStore.listRecordStores() != null)
            {
                try
                {
                    recordstore.deleteRecordStore("MY RecordStore");
                }
                catch (Exception error)
                {
                    alert = new Alert("Error Removing", error.toString(),null, AlertType.WARNING);
                    alert.setTimeout(Alert.FOREVER);
                    display.setCurrent(alert);
                }
            }
        }
    }

but when i run it , instead of my record i see this error :

public void commandAction(Command command, Displayable displayable) {
        if(command==exit)
        {
            destroyApp(true);
            notifyDestroyed();
        }
        else if(command==start)
        {
            try
            {
                recordstore=RecordStore.openRecordStore("My RecordStore",true); // LINE 1 
            }
            catch(Exception error)
            {
                alert=new Alert("Error Creating",error.toString(),null,AlertType.WARNING);
                alert.setTimeout(Alert.FOREVER);
                display.setCurrent(alert);
            }
            try
            {
                String outPutData[]={"Mary","Bob","Adam"};
                for(int x=0;x<3;x++)
                {
                byte[] byteOutPutData=outPutData[x].getBytes();
                recordstore.addRecord(byteOutPutData,0,byteOutPutData.length);
                }
            }
                
            catch(Exception error)
            {
                    alert=new Alert("Error Waiting",error.toString(),null,AlertType.WARNING);
                    alert.setTimeout(Alert.FOREVER);
                    display.setCurrent(alert);
            }
            try 
            {
                byte[] byteInputData=new byte[1];
                int length=0;
                for(int x=1;x<=recordstore.getNumRecords();x++)
                {
                    if(recordstore.getRecordSize(x)>byteInputData.length)
                    {
                        byteInputData=new byte[recordstore.getRecordSize(x)];
                    }
                    length=recordstore.getRecord(1,byteInputData,0);
                }
                alert = new Alert("Reading", new String(byteInputData, 0,length), null, AlertType.WARNING);
                alert.setTimeout(Alert.FOREVER);
                display.setCurrent(alert);
                
                
            }
            catch (Exception error)
            {
               alert = new Alert("Error Reading", error.toString(),null, AlertType.WARNING);
               alert.setTimeout(Alert.FOREVER);
               display.setCurrent(alert); 
            }
            try
            {
                recordstore.closeRecordStore();
            }
            catch (Exception error) 
            {
                alert = new Alert("Error Closing", error.toString(),null, AlertType.WARNING);
                alert.setTimeout(Alert.FOREVER);
                display.setCurrent(alert);
            }
            if (RecordStore.listRecordStores() != null)
            {
                try
                {
                    recordstore.deleteRecordStore("MY RecordStore"); // LINE 2
                }
                catch (Exception error)
                {
                    alert = new Alert("Error Removing", error.toString(),null, AlertType.WARNING);
                    alert.setTimeout(Alert.FOREVER);
                    display.setCurrent(alert);
                }
            }
        }
    }

Check "Line 1" and "Line 2" tags.

"My RecordStore" and "MY RecordStore" both are different names.

Theres no RS with name "MY RecordStore". Thats why its showing error.

Regards,

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.