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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With