Solved

Oracle OLE C++ Classes/Select works/Insert fails

Posted on 2001-08-11
6
325 Views
Last Modified: 2006-11-17
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-Error:", 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-Error:", oses.GetErrorText() , MB_OK);
0
Comment
Question by:rgcomm
6 Comments
 
LVL 3

Expert Comment

by:p_yaroslav
ID: 6379599
Hello!

Check permissions on insert into this table.

Yaroslav.
0
 

Author Comment

by:rgcomm
ID: 6380357
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.
0
 

Author Comment

by:rgcomm
ID: 6413602
I changed the code to AddNewRecord instead of INSERT and all works well now.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 6

Expert Comment

by:Mindphaser
ID: 7042689
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.
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7057852
rgcomm has solved this himself.  I recommend:

       Refund points and save as a 0-pt PAQ.

DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Accepted Solution

by:
Moondancer earned 0 total points
ID: 7057944
Thanks, Dan.
I finalized this today and will monitor it in the event an adjustment is needed.
50 points refunded and moved to PAQ/closed.
Moondancer - EE Moderator
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
oracle query help 36 83
Calculating percentages per course - Oracle Query 3 41
Wrong number of values in the INTO list of a FETCH statement 16 46
Oracle Pivot Question 8 45
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now