Results 1 to 2 of 2

Thread: ADO AddNew method

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2000
    Location
    Somerset, NJ, USA
    Posts
    3

    Post

    Hi,
    I'm trying to use the AddNew method of ADO recordset object. In my table I have an Identity(Auto number) field which I need to access before updating as another field is a string format of the same number. My recordset properties are:
    CursorLocation = adUseClient
    Cursor Type = adOpenDynamic
    Locktype = adLockOptimistic
    Other details
    DB - SQL Server 7.0
    ADO 2.1

    I'm unable to access the Identity field even after the update.
    With DAO Addnew method I can access the Auto number field as soon as I say AddNew.


    Any help is appreciated
    Thanks
    Poornima

  2. #2
    Junior Member
    Join Date
    Apr 1999
    Location
    Bangalore, KA, India
    Posts
    18

    Post

    1. If your table has any other primary key fields apart from the auto number field, then you have a to fire a query to get the value if the autnumbered column.

    2. If it not, then you can get the value of the auto numbered field by firing the followinf query

    SELECT MAX(aAutoNumCol) FROM myTable

    Hope it will solve your problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width