locked
I have one question. RRS feed

  • Question

  • User-2109641253 posted

    Hi

    I would ask you about onething.

    I am building project for library, I am using SqlHelper from microsoft, but my problem is:

    When I want to add book as an example, I am using SqlHelper.ExecuteNotQuery() that call stored procedure in sql server 2005,

    but I want to get an identitfier number that sql server generated for primary key field.

    How can I use SqlHelper to get something like this.

    By the way, in stored procedure after insert statment I wrote SELECT SCOPE_IDENTITY();

    I am sory my english is not good.

    Thank you very much

    Wednesday, April 18, 2007 11:16 PM

Answers

  • User-158764254 posted

    change SqlHelper.ExecuteNonQuery to SqlHelper.ExecuteScalar so that the identity value will be returned.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 18, 2007 11:21 PM

All replies

  • User-158764254 posted

    change SqlHelper.ExecuteNonQuery to SqlHelper.ExecuteScalar so that the identity value will be returned.

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 18, 2007 11:21 PM
  • User-2109641253 posted
    Thank you very much.
    Thursday, April 19, 2007 2:58 PM