|
|
User login
Feeds |
database issue
|
|||||
| Mon, 2004-08-23 08:14 | |
|
|
i write the following code in my dialog class for creating the database:-
CMyDatabase database; database.MakeDatabase(database); in CMyDatabase:- void CMyDatabase::MakeDatabase(RDbNamedDatabase database) { //create the file session RFs fsSession; User::LeaveIfError(fsSession.Connect()); CleanupClosePushL(fsSession); //create the database _LIT(KDbFileName,"C:\\mydatabase"); User::LeaveIfError(database.Create(fsSession, KDbFileName)); CleanupClosePushL(database); // Create tables etc. CleanupStack::PopAndDestroy();//database } gives me an error:- Error : illegal access to protected/private member CDemoTextListBoxControl.cpp line 66 Error : Compile failed i know i am making a silly mistake will someone please point it out to me. ciao |
Forum posts: 364
Forum posts: 148
this is the line 66 code..as i am calling the function and then passing the same object as well in it..could this be the error..?
ciao
Forum posts: 982
this is the line 66 code..as i am calling the function and then passing the same object as well in it..could this be the error..?
ciao
Can you provide h file for CMyDatabase?
pirosl
Forum posts: 148
#ifndef CMyDatabase_H
#define CMyDatabase_H
#include "d32dbms.h "
#include "f32file.h"
class CMyDatabase: RDbNamedDatabase
{
public:
CMyDatabase();
virtual ~CMyDatabase();
void MakeDatabase(RDbNamedDatabase);
};
#endif // CMyDatabase_H
thats the .h for CMyDatabase
ciao
Forum posts: 982
To solve you problem make like this:
in h file:
class CMyDatabase: RDbNamedDatabase
{
public:
CMyDatabase();
virtual ~CMyDatabase();
void MakeDatabase(RDbNamedDatabase*);
};
in cpp file
CMyDatabase* database = new CMyDatabase();
database->MakeDatabase(database);
And of course other changes in MakeDatabase according to the fact that you have a pointer now.
Lucian
pirosl
Forum posts: 148
User::LeaveIfError(database.Create(fsSession, KDbFileName));
CleanupClosePushL(database);
?
ciao
Forum posts: 982
User::LeaveIfError(database.Create(fsSession, KDbFileName));
CleanupClosePushL(database);
?
ciao
User::LeaveIfError(database->Create(fsSession, KDbFileName));
CleanupClosePushL(database);
Normally it's possible
Lucian
pirosl
Forum posts: 148
Error : illegal access to protected/private member
CDemoTextListBoxControl.cpp line 66
Error : Compile failed
Error : expression syntax error (instantiating: 'CleanupClose<RDbNamedDatabase *>::Close(void *)')
E32BASE.INL line 490
Error : Compile failed
ciao
Forum posts: 982
pirosl
Forum posts: 148
now the problem i am facing is that the database that has been created cant be opened
it says:-UnRecognised database format 'C:\Symbian\UIQ_70\epoc32\winscw\c\mydatabase.mdb
Also another issue that i am facing is that it shows me the database in the C drive but my application crashes..
can anyone tell me what could be the issue?
ciao
Forum posts: 982
pirosl
Forum posts: 148
also my database is being created but the application crashes.
ciao
Forum posts: 982
also my database is being created but the application crashes.
ciao
Symbian db has a proprietary format. It's like you want to open an oracle db with ms sql (not possible). For "also my database is being created but the application crashes." can you let us know what error do you have there....with what error code crashes your app.
Lucian
pirosl
Forum posts: 148
epoc.exe has encountered a problem and needs to close.
Also what format is the database that is being created?do i have to specify such as *.mdb etc or just say the database name and it will take the database name on its own?
one more thing once i have inserted things into the database and now i want to display the contents how do i do it..will a simple :iEikonEnv->InfoMsg(data); work for me?
ciao
Forum posts: 148
ciao