Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

deleting records from a record store

 
aaron batterby
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
basically i cant get it to delete a record from my recordstore. when the code is compiled no erros are found, but when run on the emulator nothing happens! help me please. the following is the code that i have used:

public void Delete_Contact()
{
display2 = Display.getDisplay(this);
list = new List("Contacts", Choice.IMPLICIT);
try
{
enum = db.enumerate();

while(enum.hasNextElement())
{
int i = enum.nextRecordId();
temp = new String(enum.nextRecord()).trim();
record = new Record(temp);
record.send();
list.append(record.getName(), null);
}
}
catch(Exception e) {}
enum = null;
list.addCommand(delete);
list.addCommand(back);
list.addCommand(exit);
list.setCommandListener(this);
display2.setCurrent(list);
currentMenu = "Delete_Contact";
}



else if (label.equals("Delete"))
{

try
{
enum = db.enumerate();
while(enum.hasNextElement())
{
int i=enum.nextRecordId();
recordStore.deleteRecord(i);
break;
}
}
catch (Exception e) {}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic