Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. how to get autoid

how to get autoid

Scheduled Pinned Locked Moved Web Development
helpdatabasetutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    samrat net
    wrote on last edited by
    #1

    hi friend, i've a query, pls help me. suppose, i've a table which has am autoid field. now i am inserting a row in that table. how i can get the autoid of the new inserted row? is there any process to get back the autoid when use ExecuteNonQuery( ) method or else? i don't want to use max(autoid) on the that table, because it can result on concurrency problem. With Regards, samrat

    S M 2 Replies Last reply
    0
    • S samrat net

      hi friend, i've a query, pls help me. suppose, i've a table which has am autoid field. now i am inserting a row in that table. how i can get the autoid of the new inserted row? is there any process to get back the autoid when use ExecuteNonQuery( ) method or else? i don't want to use max(autoid) on the that table, because it can result on concurrency problem. With Regards, samrat

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #2

      Second star to the right, and straight on 'til morning[^]...

      Citizen 20.1.01

      'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'

      1 Reply Last reply
      0
      • S samrat net

        hi friend, i've a query, pls help me. suppose, i've a table which has am autoid field. now i am inserting a row in that table. how i can get the autoid of the new inserted row? is there any process to get back the autoid when use ExecuteNonQuery( ) method or else? i don't want to use max(autoid) on the that table, because it can result on concurrency problem. With Regards, samrat

        M Offline
        M Offline
        Manas Bhardwaj
        wrote on last edited by
        #3

        samrat.net wrote:

        is there any process to get back the autoid when use ExecuteNonQuery( )

        ExecuteNonQuery() returns the number of rows affected and nothing else.

        samrat.net wrote:

        i don't want to use max(autoid) on the that table, because it can result on concurrency problem.

        you can use

        SELECT @@IDENTITY as Value

        .

        Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups