COUNT THEN UPDATE ELSE INSERT CREATE PROCEDURE / CURSOR
How to Button1_Click Count and if (count) ==0 EXISTS update query than (count) ==1 update else insert asp .net
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Oct 14, 2013, 11:25 PM EDT
Please give us some more details.
Jignesh TrivediRank #16 · 50.3K reputationPosted Oct 15, 2013, 3:20 AM EDT
I think this can be achieve with in store procedure....
like
create procedure tes
(
@id int
)
AS
begin
if(EXISTS(select * from table1 where ID = @id)
begin
-- write you update table statement here
end
else
begin
-- write you insert table statement here
end
end
hope this will help you.