DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  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,
    >
    >



Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links