What i want is to get identity column value from database on my web application page, and i have created a stored procedure and declare E_ID as output and also set it as scope_Identity(). my aim is when user inserts data other than E_ID (as E_ID is identity column and generates automatically), Automatically generated E_ID popup on webpage that say ur empid is< E_IdD that is generated>. for that my stored procedure is :
ALTER procedure [dbo].[spuserdetails]
@Name varchar(50),
@DOB datetime,
@Age int=null,
@Address1 varchar(70),
@phone int,
@Country varchar(50) = null,
@States Varchar(50) = null,
@City varchar(50) = null,
@E_ID int Out
As
Begin
insert into userdetails(Name,DOB,Addr,phn,Country,States,City )
values (@Name,@DOB , @Address1 , @phone , @Country, @States, @City )
set @E_ID=SCOPE_IDENTITY ()
end
how can i do what i want ?