×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    2

    Question Retrieving data from RecordStore and displaying it on Form

    I am having a problem regarding RMS that I have saved a String in RecordStore like:

    RecordStore loginInfo_rs = RecordStore.openRecordStore("userLoginInfo", true);
    loginInfo_rs.addRecord("this is my record".getBytes(), 0, "this is my record".length());
    loginInfo_rs.closeRecordStore();

    and retrieving it later as:

    loginInfo_rs = RecordStore.openRecordStore("userLoginInfo", true);
    myForm.append(loginInfo_rs.getRecord(1).toString());
    loginInfo_rs.closeRecordStore();

    but it prints some special characters on the screen..

    Can anybody please help?

  2. #2
    Regular Contributor
    Join Date
    Nov 2008
    Posts
    75

    Re: Retrieving data from RecordStore and displaying it on Form

    Hi,

    First a minor point: when you first open the RecordStore it makes good sense to force it to be created if it doesn't exist (second param is 'true'). When you open it to retrieve the String you probably shouldn't be specifiying that the RecordStore should be created if necessary, as if it doesn't exist there's a real problem, and creating a new one won't help.

    That aside, perhaps you might try constructing a new String from the byte array in this way:

    Code:
    new String (loginInfo_rs.getRecord (1))
    rather than,
    Code:
    loginInfo_rs.getRecord (1).toString()
    You see, bytes are not chars, and toString really doesn't know exactly what you want to do with the bytes. The String constructor, on the other hand, knows that you want to build a String from an array of bytes, and it knows how!

    Cheers,
    Matt
    Cheers,

    Matt Brenner
    UnME2, Inc.

  3. #3
    Registered User
    Join Date
    Jul 2010
    Posts
    2

    Re: Retrieving data from RecordStore and displaying it on Form

    Thanks alot Matt.. The info you provided helped me alot
    Last edited by shehzadhussainsamnani; 2010-07-13 at 09:11.

Similar Threads

  1. Replies: 4
    Last Post: 2009-12-04, 14:16
  2. Retrieving Form Resource
    By spitzer7 in forum Symbian
    Replies: 1
    Last Post: 2009-10-12, 21:01
  3. displaying form
    By vivek_2kx in forum Symbian User Interface
    Replies: 0
    Last Post: 2005-01-10, 10:55
  4. Problem in Displaying the Form
    By pratbrat77 in forum Symbian
    Replies: 0
    Last Post: 2003-12-10, 21:09
  5. Form not displaying
    By Shabs in forum Symbian User Interface
    Replies: 0
    Last Post: 2003-07-09, 16:38

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×