Results 1 to 5 of 5

Thread: ADO.NEt Get column value after update without a select statement

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Location
    Between 2 bosses
    Posts
    210

    ADO.NEt Get column value after update without a select statement

    I need to perform an update of a table row where there are 2 field, a pk and a counter field. I need to update the counter field to +=1 and then get the value it was updated to without performing a select.

    Is this possible?

    Thanks.

  2. #2
    Hyperactive Member vincentg's Avatar
    Join Date
    Jun 2005
    Location
    Chicago IL, USA
    Posts
    261

    Re: ADO.NEt Get column value after update without a select statement

    fetching the new value for your pk?

    Try using @@IDENTITY after insert

    INSERT INTO jobs (job_desc,min_lvl,max_lvl)
    VALUES ('Accountant',12,125)
    SELECT @@IDENTITY AS 'Identity'

  3. #3
    Hyperactive Member vincentg's Avatar
    Join Date
    Jun 2005
    Location
    Chicago IL, USA
    Posts
    261

    Re: ADO.NEt Get column value after update without a select statement

    I am not sure if it is possible ....

    SELECT ( INSERT) <---- one line...

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Location
    Between 2 bosses
    Posts
    210

    Re: ADO.NEt Get column value after update without a select statement

    Not microsoft DB,
    Sorry I should have stated that it is an Informix Database. And I can get the PK back, but the problem is that the the is only one PK value and I am updating the counter immediately and want to ensure that I get back the updated value as by the time i do a select it could have changed.

    Thanks for the reply

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Location
    Between 2 bosses
    Posts
    210

    Re: ADO.NEt Get column value after update without a select statement

    Thanks
    But SELECT ( INSERT) <---- one line...
    does not work. Just tried.

    Thanks for the suggestion

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