If Row Exists, Update, Else Insert in Asp .net
fields : StudentID, FirstName, LastName and Status
CREATE PROCEDURE ExistsUpdateInsert(
@StudentID int,
@FirstName [nvarchar](50),
@LastName [nvarchar](50),
@Status [nvarchar](50)
)
AS
BEGIN
IF EXISTS (SELECT StudentID FROM StudentTable WHERE StudentID =@StudentID)
UPDATE StudentTable set StudentID=@StudentID WHERE Status='Active'
ELSE
INSERT INTO StudentTable (StudentID, FirstName, LastName)
VALUES (@StudentID, @FirstName, @LastName)
END
END
please help code