I want to get two Output values at the same time from the sql stored procedure .I am using visual studio 2005 and sql server 2005.In my stored proceudre there was no problem it returns Two Values.
@EmpSid @RevisionNo
79 2
What I have tried:
My code is here
MySID = objCmd.Parameters.AddWithValue("@EmpSid", 0)
RevisionNo = objCmd.Parameters.AddWithValue("@RevisionNo", 1)
objCmd.Parameters.Item("@EmpSid").Direction = ParameterDirection.Output
objCmd.Parameters.Item("@RevisionNo").Direction = ParameterDirection.Output
objCmd.ExecuteNonQuery()
Sql Procedure
ELSE IF @Mode='EDIT'
BEGIN
Select @RevisionNo = RevisionNo+1 from tblEmployeeMaster where SID=@EmpSid
UPDATE tblEmployeeMaster set CompanySID=@CompanySID, EmpCode=@Empcode,HonorficsSID=@HonorficsSID,EmpName=@EmpName,
Dob=@Dob, MaritalStatusSID=@MaritalStatusSID, GenderSID=@GenderSID, BloodGroup=@BloodGroup,
DateOfJoin=@DateOfJoin,EmpPhoto=@EmpPhoto ,Notes=@Notes,RevisionNo=@RevisionNo, CreatedBy=@CreatedBy, CreatedOn=GETDATE(),
EditedBy=@CreatedBy,EditedOn=GETDATE() WHERE SID=@SID
SET @EmpSid=@SID
END
It shows an error
Cannot insert the value NULL into column 'RevisionNo', table 'JSolutionHR.dbo.tblEmployeeMaster'; column does not allow nulls. UPDATE fails.
The statement has been terminated.