Not able to Add Contacts.....
| Thu, 2005-03-17 11:02 | |
|
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) ![]() 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 ![]() shashi_blr |
|








Forum posts: 112
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
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)
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
Forum posts: 1
#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
#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.