rgcomm
asked on
Oracle OLE C++ Classes/Select works/Insert fails
The select statement below works great, but when I try to insert, the (ores != OSUCCESS). Can read from TB1 but can not write.
Please Help
//************************ ********** ********** ********
OSession oses; // database session object
ODatabase odb; // the database object
ODynaset oDB1; // dynaset object
oresult ores; // indicates whether operation succeeded
OStartup(); // Start Environment
// open the default (unnamed) session
if(!oses.IsOpen())
ores = oses.Open();
if (ores != OSUCCESS)
MessageBox("oses.Open:", oses.GetErrorText() , MB_OK);
// connect to the database
if(!odb.IsOpen())
ores = odb.Open(oses, "MyDB.world", "system", "manager");
if (ores != OSUCCESS)
MessageBox("ores.Open:", oses.GetErrorText() , MB_OK);
//************************ ********** ********** **********
strcpy(strFilter, "SELECT * FROM TBL1 WHERE FLD1 = 'A001'");
if(oDB1.IsOpen())
oDB1.Close();
ores = oDB1.Open(odb, strFilter);
if (ores != OSUCCESS)
MessageBox("oDB1.Open-Erro r:", oses.GetErrorText() , MB_OK);
//************************ ********** ********** **********
strcpy(strFilter, "INSERT INTO TBL1 VALUES ('A002')");
if(oDB1.IsOpen())
oDB1.Close();
ores = oDB1.Open(odb, strFilter);
if (ores != OSUCCESS)
MessageBox("oDB1.Open-Erro r:", oses.GetErrorText() , MB_OK);
Please Help
//************************
OSession oses; // database session object
ODatabase odb; // the database object
ODynaset oDB1; // dynaset object
oresult ores; // indicates whether operation succeeded
OStartup(); // Start Environment
// open the default (unnamed) session
if(!oses.IsOpen())
ores = oses.Open();
if (ores != OSUCCESS)
MessageBox("oses.Open:", oses.GetErrorText() , MB_OK);
// connect to the database
if(!odb.IsOpen())
ores = odb.Open(oses, "MyDB.world", "system", "manager");
if (ores != OSUCCESS)
MessageBox("ores.Open:", oses.GetErrorText() , MB_OK);
//************************
strcpy(strFilter, "SELECT * FROM TBL1 WHERE FLD1 = 'A001'");
if(oDB1.IsOpen())
oDB1.Close();
ores = oDB1.Open(odb, strFilter);
if (ores != OSUCCESS)
MessageBox("oDB1.Open-Erro
//************************
strcpy(strFilter, "INSERT INTO TBL1 VALUES ('A002')");
if(oDB1.IsOpen())
oDB1.Close();
ores = oDB1.Open(odb, strFilter);
if (ores != OSUCCESS)
MessageBox("oDB1.Open-Erro
ASKER
I have a duplicate app that is running under ADO w/CDatabase & CRecordset that works great but slow. I wanted to streamline the code using Oracle's OLE classes. I am using the same userid, password, & hostname. I also have an ISAPI Extension that works fine without error using Oracle's OLE classes. Just having trouble with this stand alone app using MFC(exe)-VC ++ v6.
ASKER
I changed the code to AddNewRecord instead of INSERT and all works well now.
Please update and finalize this old, open question. Please:
1) Award points ... if you need Moderator assistance to split points, comment here with details please or advise us in Community Support with a zero point question and this question link.
2) Ask us to delete it if it has no value to you or others
3) Ask for a refund so that we can move it to our PAQ at zero points if it did not help you but may help others.
EXPERT INPUT WITH CLOSING RECOMMENDATIONS IS APPRECIATED IF ASKER DOES NOT RESPOND.
Thanks,
** Mindphaser - Community Support Moderator **
P.S. Click your Member Profile, choose View Question History to go through all your open and locked questions to update them.
1) Award points ... if you need Moderator assistance to split points, comment here with details please or advise us in Community Support with a zero point question and this question link.
2) Ask us to delete it if it has no value to you or others
3) Ask for a refund so that we can move it to our PAQ at zero points if it did not help you but may help others.
EXPERT INPUT WITH CLOSING RECOMMENDATIONS IS APPRECIATED IF ASKER DOES NOT RESPOND.
Thanks,
** Mindphaser - Community Support Moderator **
P.S. Click your Member Profile, choose View Question History to go through all your open and locked questions to update them.
rgcomm has solved this himself. I recommend:
Refund points and save as a 0-pt PAQ.
DanRollins -- EE database cleanup volunteer
Refund points and save as a 0-pt PAQ.
DanRollins -- EE database cleanup volunteer
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Check permissions on insert into this table.
Yaroslav.