Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADO Adding records to Oracle RBMS

Status
Not open for further replies.

RobV

Programmer
Feb 8, 2001
66
NL
I'm experienced with SQL server 7 and Access, but not with Oracle, and I need to do some maintenance on an Oracle 8i server. I stumbled across a problem:

A particular table has an insert trigger so that new ID's are being generated by a sequence at insert. However, after insert, that key cannot be obtained in ADO.

Code:
oRecordset.Open "tblUser", oConnection
oRecordset.AddNew
oRecordset.Fields("sName") = strMyName
oRecordset.Update
lngNewKey = oRecordset.Fields(&quot;lUserID&quot;) '<-- fails!
oRecordset.Close

The second last statement (lngNewKey = ..) does not fail but only returns an empty value. I need that value!

I'm wondering if there are ways to solve this problem. But please: if possible, without any database changes!

Help me, please.. Bye,

Rob.
 
I think it is down to cursor location, should be adUseServer. Unless it is a Oracle oddity. Peter Meachem
peter@accuflight.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top