Not able to Add Contacts.....

Login to reply to this topic.
Thu, 2005-03-17 11:02
Joined: 2005-02-11
Forum posts: 15
HI,

I am writing series 80 application.
When my application is launched I am trying to read the contacts from the
default contact database and copy them to MyContactDatabase(KMyFile).
Reading from the default contact database is OK.
But when i try to Add that contact to MyDataBase application is Hanging.(temp = iSrc->AddNewContactL(*itemold)Wink

It gives System Error:: System Not Ready...


_LIT(KMyFile,"\\system\\data\\Contactsuti.cdb");

         iDest =CContactDatabase::OpenL ();
         CleanupStack::PushL (iDest);
         iSrc = CContactDatabase::OpenL (KMyFile);
         CleanupStack::PushL (iSrc);
         CContactItem* itemold;
         TContactItemId oldcard,temp;
         TContactIter clean(*iDest);
                     
                  
           while( ( oldcard = clean.NextL() ) != KNullContactId )

           {

               TRAPD(err, (itemold = iDest->ReadContactL(oldcard)));
            if(err == KErrNotFound)
            {
               itemold = NULL;
               continue;

            }

              CleanupStack::PushL(itemold);

               temp = iSrc->AddNewContactL(*itemold);

               iSrc->CloseContactL(temp);

               iDest->DeleteContactL(oldcard);

               CleanupStack::Pop();
            delete itemold;
               itemold = NULL;

           }


What could be the problem?
Plaease guide me if someone have the answers..

Thanks ion advance
Shashi Angry

shashi_blr


Thu, 2005-04-28 09:05
Joined: 2005-01-22
Forum posts: 112
Re: Not able to Add Contacts.....
hello Shashi_blr,
  i m facing same problem when i m adding data in to my database pls help me if u have been got the answer.
thanks with regards

Quote from: Shashi_blr
HI,

I am writing series 80 application.
When my application is launched I am trying to read the contacts from the
default contact database and copy them to MyContactDatabase(KMyFile).
Reading from the default contact database is OK.
But when i try to Add that contact to MyDataBase application is Hanging.(temp = iSrc->AddNewContactL(*itemold)Wink

It gives System Error:: System Not Ready...


_LIT(KMyFile,"\\system\\data\\Contactsuti.cdb");

         iDest =CContactDatabase::OpenL ();
         CleanupStack::PushL (iDest);
         iSrc = CContactDatabase::OpenL (KMyFile);
         CleanupStack::PushL (iSrc);
         CContactItem* itemold;
         TContactItemId oldcard,temp;
         TContactIter clean(*iDest);
                     
                  
            while( ( oldcard = clean.NextL() ) != KNullContactId )

            {

                TRAPD(err, (itemold = iDest->ReadContactL(oldcard)));
            if(err == KErrNotFound)
            {
               itemold = NULL;
               continue;

            }

              CleanupStack::PushL(itemold);

                temp = iSrc->AddNewContactL(*itemold);

                iSrc->CloseContactL(temp);

                iDest->DeleteContactL(oldcard);

                CleanupStack::Pop();
            delete itemold;
                itemold = NULL;

            }


What could be the problem?
Plaease guide me if someone have the answers..

Thanks ion advance
Shashi Angry
Tue, 2006-01-17 15:26
Joined: 2006-01-16
Forum posts: 1
Re: Not able to Add Contacts.....
I had similar problem and got it resolved with couple of changes,

#1. The path name of the path of the file should include the file name also ("c:\\system\\data\\...).  If the drive name is not include the CContactDatabase::OpenL() and CContactDatabase::CreateL() throws exception. (Really took me long time to figure this out Huh)

#2. If the intention is to copy into a new database file then CreateL() needs to be used instead of OpenL(). The OpenL() expects the database file to be already present whereas CreateL() creates and opens new database.

--
Regards,
Rams.
  • Login to reply to this topic.