How to use output parameter to get the last inserted record ID

HOW GET ID OF LAST INSERTED RECORD

Introduction 

This small article is based on a situation where you need the ID of your latest inserted record. What does that mean is, on every insert you want to get the ID of the currently inserted record by which you can know that record inserted successfully or not, and can use its ID.

There are several ways  to achieve this. 

We will use output parameter and in our c# code behind we will use. 

SqlParameter with Direction property

Here is our procedure
OutParameter1.png

Now this is our c# code behind (.cs) file where we getting @getID value
OutParameter2.png