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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Help with Visual Basic "INSERT" statement

Re: Help with Visual Basic "INSERT" statement

From: Randy <harrisr_at_bignet.net>
Date: Wed, 29 Aug 2001 13:36:38 -0400
Message-ID: <toqa197b53o4e1@corp.supernews.com>


Hi Teresa,

As suggested in another reply, the standard method of writing the sequence number into the record is to use a trigger. It is also fairly easy to do in a VB recordset. I use ADO and hence don't know the RDO syntax, however, there should be an equivalent.

NewKeyValue = conn.Execute "SELECT main_pkey.nextval FROM dual".GetString

NewKeyValue will now contain the next sequence number, so:

rs.rdoColumns("pkey").Value = NewKeyValue ...

HTH
Randy Harris

"Teresa Redmond" <pixelmeow_at_aol.com> wrote in message news:1t1ootsldoa4099nh6nl1qme5cbj1lrnl2_at_4ax.com...
> Hi, all:
>
> I am using Visual Basic 6 to connect to an Oracle 8i database and add
> records. I have a sequence defined, main_pkey, which increments the
> pkey field of the main table. I have this code, using RDO, in VB,
> which updates the table main:
>
> ...
> rs.rdoColumns("pkey").Value = main_pkey.nextval
> rs.rdoColumns("title").Value = Decode(i).First.Title
> rs.rdoColumns("onlink").Value = Decode(i).First.OnLink
> rs.rdoColumns("northbc").Value = Decode(i).First.NorthBC
> ...
>
> Now, as you probably know, that first line doesn't work. Does
> *anyone* here know how I can do this???
>
> Thanks in advance,
>
> --
> Teresa Redmond
> Associate Software Engineer
> Anteon Corporation
> tredmond_at_anteon.com
Received on Wed Aug 29 2001 - 12:36:38 CDT

Original text of this message

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