Hello,I have a stored procedure that updates my table from values entered in a datatable in my windows app.An error occurs 1/2 way through the update process. I assumed that by implementing the rollback transaction command that the inserted lines would not be saved to my db. This is not the case. Here is my code, where am I going wrong?ALTER PROCEDURE [dbo].[spUploadUser](@userid varchar(10), @username varchar(50), @userstatus varchar(20))ASBEGIN SET NOCOUNT ON; DECLARE @ERROR_STATE INT; BEGIN TRANSACTION INSERT INTO userprofile (uid, uname, ustatus) VALUES @userid, @username, @userstatus; SELECT @ERROR_STATE = @@ERROR; IF (@ERROR_STATE <> 0) BEGIN ROLLBACK TRANSACTION RETURN -1 END ELSE COMMIT TRANSACTIONEND
Regards,MizPippz