hi
i have a problem. when run blow store proc , only first statement excute and another states do not excute . please help me.
----------------------
begin try
BEGIN
IF (SELECT COUNT(PK_ID) FROM Sanad_Bargiri WHERE Shomareh_Sanad=@Shomareh_Sanad) = 0
begin
insert into Sanad_Bargiri (Fk_Agency,Ty_Mojavez,Shomareh_Nameh,Shomareh_Havaleh,Date_Reg,Shomareh_Sanad,Fk_SahebKala,Add_frestandeh,Mahal_Bargiri,MaghSad,Vazn,Fk_Girandeh,Add_girandeh,Type_Kala,Ty_Pardakht_Haml,nam_pardakh_haml,Nerkh_Kerayeh_Barnameh,Disc)
values (@Fk_Agency,@Ty_Mojavez,@Shomareh_Nameh,@Shomareh_Havaleh,@Date_Reg,@Shomareh_Sanad,@Fk_SahebKala,@add_ferestandeh,@Mahal_Bargiri,@MaghSad,@Vazn,@Fk_Girandeh,@add_girandeh,@Type_Kala,@Ty_Pardakht_Haml,@nam_pardakh_haml,@Nerkh_Kerayeh_Barnameh,@Disc)
return 1
END
updaTE SahebKala
set Address=@add_ferestandeh
where SahebKala.ID=@Fk_SahebKala
update SahebKala
set Address=@add_girandeh
where ID = @Fk_Girandeh
END
END TRY
begin catch
print 'Error'
end catch