AddNew method in ADO is different than in DAO...


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: AddNew method in ADO is different than in DAO...

  1. #1
    Sergio Duenas Guest

    AddNew method in ADO is different than in DAO...


    I use a DAO control to access a table in a Access database. The table has
    an ID field which is autonumber.

    When using the AddNew method in DAO, the ID is generated right away. However,
    in ADO it is not generated until the Update method is executed.

    Any idea on how can I have the ID value at the time the AddNew method (ADO)
    is executed ?
    Thanks,



  2. #2
    Justin Spencer Guest

    Re: AddNew method in ADO is different than in DAO...


    Try this Sergio, it seems to work well for me (VB6sp3 ADO2.5)

    dim lngNewUID as integer

    rs.update
    rs.requery
    lngNewUID = rs!ID

    Good luck


    "Sergio Duenas" <sergio_duenas@hotmail.com> wrote:
    >
    >I use a DAO control to access a table in a Access database. The table has
    >an ID field which is autonumber.
    >
    >When using the AddNew method in DAO, the ID is generated right away. However,
    >in ADO it is not generated until the Update method is executed.
    >
    >Any idea on how can I have the ID value at the time the AddNew method (ADO)
    >is executed ?
    >Thanks,
    >
    >



  3. #3
    Charles Corcoran Guest

    Re: AddNew method in ADO is different than in DAO...


    Check the cursor, see..
    PRB: AutoNumber Field Is Not Incremented When Using ADO
    ID: Q190370

    Charles Corcoran




    "Sergio Duenas" <sergio_duenas@hotmail.com> wrote:
    >
    >I use a DAO control to access a table in a Access database. The table has
    >an ID field which is autonumber.
    >
    >When using the AddNew method in DAO, the ID is generated right away. However,
    >in ADO it is not generated until the Update method is executed.
    >
    >Any idea on how can I have the ID value at the time the AddNew method (ADO)
    >is executed ?
    >Thanks,
    >
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center