Discussion Board

Results 1 to 5 of 5
  1. #1
    Regular Contributor ninidotnet's Avatar
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246
    Hi,

    I wasn't able to add data previously so I try some other ways to create database.

    I managed to add dummies data into a database...
    Code:
    void CSMSExampleAddressContainer::CreateRecordL()
    {
        _LIT( KName, "Nini");
        _LIT( KPhone, "0122536387");
        _LIT(KKey, "1234");
    
        TBuf<50> bufName;
        TBuf<50> bufPhone;
        TBuf<50> bufPublicKey;
    
        bufName = KName;
        bufPhone = KPhone;
        bufPublicKey = KKey;
    
        iEngine->SetName( bufName );
        iEngine->SetPublicKey( bufPublicKey );
        iEngine->SetPhone( bufPhone );
    
        // Now create the record
        iEngine->AddRecordL();
    }
    The problem now is to add data (contact name, contact number) that is read from array together with defined key into the database. No error while adding data but I found it's empty when I open the database.
    Code:
    void CSMSExampleAddressContainer::CreateRecordL()
    {
        TBuf<50> bufName;
        TBuf<50> bufPhone;
        TBuf<50> bufPublicKey;
    
        bufName = KName;
        bufPhone = KPhone;
        bufPublicKey = KKey;
    
        // Get current contact name in listbox
        TInt Index = iAddListBox->CurrentItemIndex();
    
        bufPhone.Copy((*iNumberArray)[Index]);    // Get contact number in array
        bufName.Copy((*iTextArray)[Index]);     // Get contact name in array
    
        iEngine->SetName( bufName );
        iEngine->SetPublicKey( bufPublicKey );
        iEngine->SetPhone( bufPhone );
    
        // Now create the record
        iEngine->AddRecordL();
    }
    Do you have any idea what mistake I did?
    Thanks...
    Regards,
    Nini

  2. #2
    Super Contributor eswar_illuri's Avatar
    Join Date
    May 2005
    Location
    Hyderabad,India
    Posts
    704
    Hi,

    This code will work, and what's the function AddRecordL() will do.

    Regards,
    eswar

  3. #3
    Regular Contributor ninidotnet's Avatar
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246
    Hi eswar,

    My problem solved.
    But I found it is not working when I try to call it from a dialog.

    Code:
    void CSMSExampleAddressContainer::CreateRecordL()
    {
        _LIT(KKey, "1234");
        TBuf<50> bufName;
        TBuf<50> bufPhone;
        TBuf<50> bufPublicKey;
    
        bufPublicKey = KKey;
    
        // Get current contact name in listbox
        TInt Index = iAddListBox->CurrentItemIndex();
    
        bufPhone.Copy((*iNumberArray)[Index]);    // Get contact number in array
        bufName.Copy((*iTextArray)[Index]);     // Get contact name in array
    
        _LIT(KSendMessage, "You've selected ");
        _LIT(KDot, ".");
        TBuf<100> textMessage;
        textMessage.Append( KSendMessage );
        textMessage.Append( bufName);
        textMessage.Append( KDot );
    
        CAknNoteDialog* note = new (ELeave) CAknNoteDialog (CAknNoteDialog::EConfirmationTone);
        note->PrepareLC(R_CONFIRMATIONNOTE_DISPLAY_NOTE);
        note->SetTextL (textMessage);
        if ( note->RunLD() )
        {
            // If Yes then send name, number and key to recipient
            iEngine->SetName( bufName );
            iEngine->SetPublicKey( bufPublicKey);
            iEngine->SetPhone( bufPhone);
    
            // Now create the record
            iEngine->AddRecordL();        
        }
    }
    Do you know how to pass data to another function when user press 'OK' for the dialog? Thanks...
    Regards,
    Nini

  4. #4
    Super Contributor eswar_illuri's Avatar
    Join Date
    May 2005
    Location
    Hyderabad,India
    Posts
    704
    Hi,

    U can do like this,

    TInt iRes = iNote->RunLD();
    if(iRes == EAknSoftkeyOk)
    {}
    else
    {}

    regards,
    eswar

  5. #5
    Regular Contributor ninidotnet's Avatar
    Join Date
    Apr 2006
    Location
    Malaysia
    Posts
    246
    Hi,

    Thanks eswar. but it's not working...
    Regards,
    Nini

Similar Threads

  1. database problem...
    By mayankkedia in forum Symbian C++
    Replies: 12
    Last Post: 2004-08-25, 09:08
  2. Database Server - problem accessing table names
    By ash_bhatia in forum Symbian C++
    Replies: 2
    Last Post: 2004-03-24, 18:54
  3. InsertL in database Controls the DB
    By Blkangel in forum Symbian C++
    Replies: 5
    Last Post: 2004-01-13, 15:02
  4. problem while creating database
    By ManishPatil in forum Symbian C++
    Replies: 4
    Last Post: 2003-12-26, 15:33
  5. 7210 Silent Problem
    By MarkMckim in forum Mobile Java General
    Replies: 1
    Last Post: 2003-03-18, 12:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved