Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Triggers and ADO

Re: Triggers and ADO

From: Jen Decker <jen_at_sunflower.com>
Date: Wed, 08 Aug 2001 08:53:53 -0500
Message-ID: <B796AEA0.4487%jen@sunflower.com>

Dear Artur,
I think you need to insert the row first then use your sequence to fill the column.

CREATE OR REPLACE TRIGGER TR_MY_TABLE_INSERT AFTER INSERT ON MY_TABLE
FOR EACH ROW
BEGIN
SELECT SQ_MY_TABLE_ID.nextval INTO :new.ID FROM DUAL; END; I hope this helps.
Jen

Artur wrote:

> Hi
> I am having a problem with adding new records to a table using ADO. A
> table has unique column named "ID".
> When I adding new row to the table I use trigger ( SQ_MY_TABLE_ID is a
> sequence) :
>
> CREATE OR REPLACE TRIGGER TR_MY_TABLE_INSERT
> BEFORE INSERT ON MY_TABLE
> FOR EACH ROW
> BEGIN
> SELECT SQ_MY_TABLE_ID.nextval INTO :new.ID FROM DUAL;
> END;
>
> To add new data I use:
> _variant_t val("My String")
> m_Recordset->AddNew();
> m_Recordset->Fields->GetItem(2)->Value = val;
> m_Recordset->Update();
>
> val = m_pRS->Fields->GetItem("ID")->Value;
> // variable val CONTAINS "ID" = 0 ???????
> How can I get those ID ?????
>
> Thank you,
> Artur
Received on Wed Aug 08 2001 - 08:53:53 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US