Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you want to return a value I would suggest creating another variable in the stored procedure instead of using a value that you use for input.</p> <p>This is what I would do:</p> <pre><code>@returnValue int OUTPUT @TeamMemberId int, @FirstName varchar(25), @LastName varchar(30), @ContactNumber varchar (20), @ContactExt varchar (20) , @EmailAddress varchar(100), @Fax varchar (25), @LocationCity varchar (20), @LocationState varchar (20), @BeginWorkHrs int, @BeginWorkTime varchar (20) , @EndWorkHrs int , @EndWorkTime varchar (20) , @ZONE Varchar (20), @TeamMemberLanId varchar (20), @ManagerId varchar (20), @UpdateDate datetime </code></pre> <p>AS </p> <p>BEGIN</p> <pre><code>SET NOCOUNT ON; UPDATE dbo.LoanOwnerStamp SET FirstName = @FirstName, LastName = @LastName, ContactNumber = @ContactNumber, ContactExt = @ContactExt , EmailAddress = @EmailAddress, Fax = @Fax, LocationCity = @LocationCity, LocationState = @LocationState, BeginWorkHrs = @BeginWorkHrs, BeginWorkTime = @BeginWorkTime, EndWorkHrs = @EndWorkHrs, EndWorkTime = @EndWorkTime, Zone = @Zone, TeamMemberLanId = @TeamMemberLanId, ManagerId = @ManagerId , UpdatedDate = @UpdateDate WHERE TeamMemberLanId = @TeamMemberLanId AND TeamMemberId = @TeamMemberId SET @returnValue= SCOPE_IDENTITY() RETURN @returnValue </code></pre> <p>END</p> <p>And on your code behind:</p> <p>EDIT:You also need to add this:</p> <pre><code>updatetLSTeamMember.Parameters.AddWithValue("@TeamMemberId", int.Parse(txtTeamMemberId.Text)); // or wherever you are getting the team member id from. pID = updatetLSTeamMember.Parameters.Add("@returnValue", SqlDbType.Int); pID.Direction = ParameterDirection.Output; string idcat = updatetLSTeamMember.Parameters["@returnValue"].Value.ToString(); </code></pre> <p>NOTE: I have never used SCOPE_IDENTITY() On an Update. You might want to look into that.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload