Results 1 to 3 of 3

Thread: [RESOLVED] how to get the autoIncrement field value ?

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2006
    Location
    Taiwan
    Posts
    37

    Resolved [RESOLVED] how to get the autoIncrement field value ?

    i'm using .net 2.0 framework, c# language.

    i got a table with a column set to be identity (auto increment by 1 every time i enter a row of data)

    the details :
    rid (int) : the primary key with auto increment 1
    inTime(date)
    outTime(date)

    my insert query : "INSERT INTO [aTable] VALUES ('1984/3/3' , '1984/3/3')"
    now..
    is it possible, after i insert the data, i directly get a return of the 'rid' which is set to be auto incremented ?

  2. #2
    Banned
    Join Date
    Nov 2005
    Posts
    2,367

    Re: how to get the autoIncrement field value ?

    The syntax is VB.Net, but it should be a simple conversion (ADO.Net is really persistent between VB and C#).
    http://www.vbforums.com/showthread.php?t=379394

    If you need help switching it over or have probs; let me know.

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2006
    Location
    Taiwan
    Posts
    37

    Re: how to get the autoIncrement field value ?

    ouw..
    awesome..
    thx for da code..
    it solve my problem directly

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