7

I'm currently calling a stored procedure from a .net application that inserts records into the database. However, I need to get a list of the records that I've just inserted successfully.

I know that I could return the inserted rows from the stored procedure directly, but I was hoping there was a way to do this programatically in C#.

Is it possible to implement the SQLDataReader class in order to achieve this functionality i.e. reading from the inserted/deleted tables? Or is there some other class that can accommodate this request?

1 Answer 1

5

The inserted/deleted tables are available in the OUTPUT clause of the INSERT statement. You could use the OUTPUT clause in the INSERT in your stored procedure and use SQLDataReader to pick up the result.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.