Hi, I'm using stored procedure to retrieve last identity value inserted in a table to use in other table as foreign key
my stored procedure is as follow:

ALTER PROCEDURE Sproc_Insert_Upload_App_form

@AppNo INT OUTPUT,

@AppName varchar(50),

@AppDescription varchar(100),

@Keywords varchar(50)


AS
BEGIN


INSERT INTO App_win_form
(

AppName,
AppDescription,
Keywords
)


  VALUES (
 @AppName, @AppDescription, @Keywords)


 /* retrieve the last insert of identity value*/

SET @AppNo = CAST(SCOPE_IDENTITY() AS INT)

END

My SQL to insert data in the table as follow

Sub InsertApplicationDetails()

        Dim ConnectionString As String = ConfigurationManager.ConnectionStrings( ...

Go to the complete details ...