Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User znrabbit's Avatar
    Join Date
    Nov 2005
    Posts
    3
    I use the commonframework.h as my head file, and fill my code into the doExampleL() .It crashes when it try to open the defualt database,and the emulator close down immediately.but before that ,everything is fine.The name of the database has print out.what is the problem?the database does not exist? what shall I do?

    #include "commonframework.h"
    #include <cntdef.h>
    #include <cntdb.h>
    #include <cntitem.h>
    #include <cntfldst.h>


    // do the example
    LOCAL_C void doExampleL()
    {
    static CContactDatabase *cdb;
    static CContactIdArray const *contacts;
    CContactItem *item;
    int i, n;


    _LIT(KTxtcontact,"contactlist:\n");
    TBuf<256> info(KTxtcontact);
    console->Printf(KTxtcontact);
    // Read name of the default database
    TBuf<60> contactDBFile; //KOrgContactFile );
    CContactDatabase::GetDefaultNameL( contactDBFile );
    contactDBFile.LowerCase();
    console->Printf(contactDBFile);

    //Open default database
    TRAPD(err, cdb= CContactDatabase::OpenL(contactDBFile));
    CleanupStack::PushL(cdb);
    //Check if database exists
    if ( err == KErrNotFound )
    {
    _LIT(Error,"not exist");
    console->Printf(Error);
    }
    else
    {
    _LIT(KTxtOK3,"ok3");
    console->Printf(KTxtOK3);

    }
    CleanupStack::PopAndDestroy(cdb);
    }

  2. #2
    Registered User znrabbit's Avatar
    Join Date
    Nov 2005
    Posts
    3
    After several attemps, I finally find out what is wrong.
    1. exe is too simple a framework for database operation. I use the app framework instead.
    2. when I set up the sdk, I didn't choose the default path. So ,the dll may not be able to locate the database.

    After I fix these to mistakes, it works.

  3. #3
    Registered User nile_mail's Avatar
    Join Date
    Dec 2006
    Posts
    26
    Hi,
    I'm Also facing same problem
    my code is
    TRAP( _resError, (contactsDb = CContactDatabase::OpenL()) );
    User::LeaveIfError(_resError);

    TRAP( _resError, CleanupStack::PushL(contactsDb));
    User::LeaveIfError(_resError);
    and it hangs on 3rd line
    How can I solve the problem?
    Above code is in a static function which will be called by a view

  4. #4
    Registered User srk2007's Avatar
    Join Date
    Oct 2007
    Posts
    42
    Hello sir,

    Caan u be more precise about ur code. I could not understand. Actually will it work on emulator. Can u give me the complete command code.





    Quote Originally Posted by znrabbit View Post
    I use the commonframework.h as my head file, and fill my code into the doExampleL() .It crashes when it try to open the defualt database,and the emulator close down immediately.but before that ,everything is fine.The name of the database has print out.what is the problem?the database does not exist? what shall I do?

    #include "commonframework.h"
    #include <cntdef.h>
    #include <cntdb.h>
    #include <cntitem.h>
    #include <cntfldst.h>


    // do the example
    LOCAL_C void doExampleL()
    {
    static CContactDatabase *cdb;
    static CContactIdArray const *contacts;
    CContactItem *item;
    int i, n;


    _LIT(KTxtcontact,"contactlist:\n");
    TBuf<256> info(KTxtcontact);
    console->Printf(KTxtcontact);
    // Read name of the default database
    TBuf<60> contactDBFile; //KOrgContactFile );
    CContactDatabase::GetDefaultNameL( contactDBFile );
    contactDBFile.LowerCase();
    console->Printf(contactDBFile);

    //Open default database
    TRAPD(err, cdb= CContactDatabase::OpenL(contactDBFile));
    CleanupStack::PushL(cdb);
    //Check if database exists
    if ( err == KErrNotFound )
    {
    _LIT(Error,"not exist");
    console->Printf(Error);
    }
    else
    {
    _LIT(KTxtOK3,"ok3");
    console->Printf(KTxtOK3);

    }
    CleanupStack::PopAndDestroy(cdb);
    }

Similar Threads

  1. Sort Contact database
    By bernie31 in forum Symbian C++
    Replies: 1
    Last Post: 2008-09-17, 09:59
  2. Replies: 3
    Last Post: 2007-12-06, 12:55
  3. Problem with contact database...
    By ashbhatia in forum Symbian C++
    Replies: 2
    Last Post: 2007-12-06, 12:38
  4. contact database change event details
    By rsajithali in forum Symbian C++
    Replies: 9
    Last Post: 2004-08-17, 00:55
  5. Deleting Default Contact Datbase
    By srinimg in forum Symbian C++
    Replies: 0
    Last Post: 2002-08-29, 08:50

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