| | |
problem in retrieving data via RMS
![]() |
•
•
Join Date: Jul 2009
Posts: 44
Reputation:
Solved Threads: 2
hi friends...
I have Written some codes for adding and retrieving data from RMS:
but when i run it , instead of my record i see this error :
I have Written some codes for adding and retrieving data from RMS:
Java Syntax (Toggle Plain Text)
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 :
Java Syntax (Toggle Plain Text)
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,
Puneet Kalra
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
www.PuneetK.com
Sun Certified Java Programmer
Admin of Pikk - Object Relational Mapping Framework
![]() |
Similar Threads
- retrieving data from sqlserver2000 in tree structure in jsp (JSP)
- retrieving data from MySQL (PHP)
- Problem with retrieving data from access 2003 (Visual Basic 4 / 5 / 6)
- problem with entering data in datagrid (VB.NET)
- VB.Net: Problem Retrieve data from ListView (VB.NET)
- retrieving "Data" from Listbox (VB.NET)
Other Threads in the Java Forum
- Previous Thread: How to locate image at different location in Jpanel
- Next Thread: Making a Java Key Logger
| Thread Tools | Search this Thread |
android api applet application apps array arrays automation awt bidirectional binary birt bluetooth businessintelligence busy_handler(null) card chat class classes client code collision columns component constructor crashcourse database designadrawingapplicationusingjavajslider draw eclipse error errors eventlistener exception expand fractal game givemetehcodez graphics gui guidancer html ide image inetaddress integer intellij j2me java javadoc javafx javamicroeditionuseofmotionsensor javaprojects jme jni jpanel jtree julia linux list loop machine map method methods mobile mobiledevelopmentcreatejar myaggfun netbeans newbie oracle plazmic print problem program programming project radio recursion scanner server set sharepoint smart sms smsspam sort sortedmaps sql string subclass support swing textfield threads tree unlimited utility webservices windows





