MindCracker
Programmer
Hi Experts,
I need an URGENT help. I applied an ODBC through a Dialog Box (base class: CDialogODBC) to open a database. Then, I selected specified table available in the database before importing it into a new data structure which can be viewed as a set of matrix entries or information vectors.
In my CDialogODBC cpp file, all data from the selected table in the database are imported into the "table" which is my new data structure as defined (see below).
//////////////////////
///CDialogODBC.cpp////
/////////////////////
....
// Load table.
if!(importer->Apply(*table) {
Message::Error("Unable to open "
;
return NULL; }
....
Now, I want this "table" to be available in my CProjectview so that I can use the data available in the "table". I applied this code:
CDialogODBC odbc(NULL);
// if user clicks OK button, update the database
if (odbc.DoModal() == IDOK) {
String str = odbc.tablestr;
//tablestr = table name in String;
ifstream stream;
stream.open(str.GetBuffer(), ios::in | ios::nocreate);
Handle<IS> table = dynamic_cast(IS *, const_cast(CDialogODBC::table));
if(!table->Load(stream)) {
Message::Error("Unable to open "
;
}
//where IS = information system, is my new data structure class
I got this error:
D:\Project\ProjectView.cpp(1712) : warning C4003: not enough actual parameters for macro 'const_cast'
D:\Project\ProjectView.cpp(1712) : error C2321: syntax error : unexpected 'CDialogODBC::table'
D:\Project\ProjectView.cpp(1712) : error C2143: syntax error : missing '(' before 'tag::id'
Error executing cl.exe.
I cant remember how to do this, the error could be the reason that I misuse the casting operator or perhaps I have missed something in the CDialogODBC. Can anyone please help me to fix this error????
Many thanks!!!!
Thank you!!
I need an URGENT help. I applied an ODBC through a Dialog Box (base class: CDialogODBC) to open a database. Then, I selected specified table available in the database before importing it into a new data structure which can be viewed as a set of matrix entries or information vectors.
In my CDialogODBC cpp file, all data from the selected table in the database are imported into the "table" which is my new data structure as defined (see below).
//////////////////////
///CDialogODBC.cpp////
/////////////////////
....
// Load table.
if!(importer->Apply(*table) {
Message::Error("Unable to open "
return NULL; }
....
Now, I want this "table" to be available in my CProjectview so that I can use the data available in the "table". I applied this code:
CDialogODBC odbc(NULL);
// if user clicks OK button, update the database
if (odbc.DoModal() == IDOK) {
String str = odbc.tablestr;
//tablestr = table name in String;
ifstream stream;
stream.open(str.GetBuffer(), ios::in | ios::nocreate);
Handle<IS> table = dynamic_cast(IS *, const_cast(CDialogODBC::table));
if(!table->Load(stream)) {
Message::Error("Unable to open "
}
//where IS = information system, is my new data structure class
I got this error:
D:\Project\ProjectView.cpp(1712) : warning C4003: not enough actual parameters for macro 'const_cast'
D:\Project\ProjectView.cpp(1712) : error C2321: syntax error : unexpected 'CDialogODBC::table'
D:\Project\ProjectView.cpp(1712) : error C2143: syntax error : missing '(' before 'tag::id'
Error executing cl.exe.
I cant remember how to do this, the error could be the reason that I misuse the casting operator or perhaps I have missed something in the CDialogODBC. Can anyone please help me to fix this error????
Many thanks!!!!
Thank you!!