This content has been marked as final. Show 9 replies
I also have this problem, any ideas?
"Jan" - I found a lot of your posts on the internet - I was hopeful your solution would work for me but it does not :( I copied you code almost entirely into my VB6 app, but no joy :( Can you or anyone else help?
I open the connection with the cursorlocation to adServer, and use adOpenKeyset with the recordset, but after the rs.update the id column is null!!!!
I am using an Oracle 8i database - could that be the problem?
I work with vb 6.0 and VB .NET.
The solution I'm using for this problem is:
1st) Create a Sequence for the specific field (E.g.
CREATE SEQUENCE XXX.XXID_SEQ
START WITH 1
2nd) Create a trigger associate to the specific table (in your case "cmptncs") that will be fired after the insert...Probably your problem is that ADO with the AddNew method firstly created the row. In any case the trigger fired after the insert should work. In the trigger (E.g.
CREATE OR REPLACE TRIGGER DLW_EVENT_MAIN_TRIGGER
REFERENCING NEW AS New OLD AS Old
FOR EACH ROW
tmpVar := 0;
SELECT DSA.XXID_SEQ.NEXTVAL INTO tmpVar FROM dual;
:NEW.XXID := tmpVar;
WHEN OTHERS THEN
-- Consider logging the error and then re-raise
) you can select the XXID_SEQ.NEXTVAL and place it into the new val...
Now it should works fine...