By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,379 Members | 1,404 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,379 IT Pros & Developers. It's quick & easy.

sp

P: 4
I want an sp to insert or update if already exists period(varchar) , year(varchar) and current status(int) into the database(table) from frontend vb.net. and set everstatus to 1 if the current status is 1 or it was 1 anytime before. the current status should be 1 when the particular period is selected. I want the sp and the corresponding databinding code in vb.net
May 19 '08 #1
Share this Question
Share on Google+
2 Replies


deepuv04
Expert 100+
P: 227
I want an sp to insert or update if already exists period(varchar) , year(varchar) and current status(int) into the database(table) from frontend vb.net. and set everstatus to 1 if the current status is 1 or it was 1 anytime before. the current status should be 1 when the particular period is selected. I want the sp and the corresponding databinding code in vb.net
here is the sample code for insert and update

[code = sql]

IF NOT EXISTS (SELECT 1 FROM Table_Name WHERE Your_Condition )
BEGIN
INSERT INTO Table_Name (Column1, Column2....)
VALUES(@Value1,@Value2....)
END
ELSE
BEGIN
UPDATE Table_Name
SET Column1 = @Value1,
Column2 = @Value2
WHERE Your_Condition
END

[/code]
May 19 '08 #2

P: 4
thanks ya, i'll try to use it
May 20 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.