when press button save and update difference table sql with C#...
jest i develop stoke management i want a current stroke level. when i enter GRN (Good received Note) data and after submit save button on time happn
01.. GRN data insert into GRN Code /Item Code..
02 .. where Item Code.. to find and update current stroke table
i want SP and C# Cord Plz help me
ALTER PROCEDURE [dbo].[GRNInfo]
@GrnId int ,
@GrnCode nchar(10) ,
@ItemCode nchar(10) ,
@Qty int ,
@TotalPrice decimal(18, 0) ,
@GrnDate date,
@NewQty int
AS
BEGIN
if not exists (select GrnId from atoGRN where GrnId=@GrnId)
begin
insert into atoGRN (GrnCode,FK_ItemCode,Qty,TotalPrice,GrnDate) values (@GrnCode,@ItemCode,@Qty,@TotalPrice,@GrnDate)
end
else
begin
update atoGRN set GrnCode=@GrnCode ,FK_ItemCode=@ItemCode ,Qty=@Qty ,TotalPrice=@TotalPrice ,GrnDate=@GrnDate where GrnId=@GrnId
end
DECLARE @CurrentQty AS INT;
select @CurrentQty = Quantity from atoQuantityDisc where FK_ItemCode=@ItemCode
begin
SET @NewQty = @CurrentQty + @Qty
UPDATE atoQuantityDisc
SET Quantity = @NewQty
WHERE FK_ItemCode=@ItemCode;
end
END


Hima BinduRank #4,292 · 353 reputationPosted Jul 18, 2016, 2:20 AM EDT
Sorry, Please be specific of your requirement when you ask a question .
If I understand it, youneed to insert/update in a tableand update in another table with stokeid, So when you are submitting you know that its an update / insert from UIthere are 2 caseshere
JohnRank #2,322 · 608 reputationPosted Jul 17, 2016, 10:18 PM EDT
Mayooran NavamanyRank #438 · 5.7K reputationPosted Jul 17, 2016, 10:28 PM EDT
Hima BinduRank #4,292 · 353 reputationPosted Jul 17, 2016, 10:36 PM EDT
Step1
Please create SP in SQL as peryour requirement
Mayooran NavamanyRank #438 · 5.7K reputationPosted Jul 17, 2016, 10:57 PM EDT
hi Hima Bindu
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Jul 17, 2016, 11:05 PM EDT