{"id":90,"date":"2014-05-15T20:28:00","date_gmt":"2014-05-15T19:28:00","guid":{"rendered":"https:\/\/debuggersspace.com\/index.php\/2014\/05\/15\/store-procedure\/"},"modified":"2014-05-15T20:28:00","modified_gmt":"2014-05-15T19:28:00","slug":"store-procedure","status":"publish","type":"post","link":"https:\/\/debuggersspace.com\/index.php\/2014\/05\/15\/store-procedure\/","title":{"rendered":"Store Procedure?"},"content":{"rendered":"<div class='booster-block booster-read-block'>\n                <div class=\"twp-read-time\">\n                \t<i class=\"booster-icon twp-clock\"><\/i> <span>Read Time:<\/span>1 Minute, 6 Second                <\/div>\n\n            <\/div><div dir=\"ltr\" style=\"text-align: left;\">\n<br \/>\nExample:<br \/>\nCREATE PROCEDURE dbo.QSPStudent<br \/>\n<span style=\"white-space: pre;\"> <\/span>(<br \/>\n<span style=\"white-space: pre;\"> <\/span>@option int,<br \/>\n<span style=\"white-space: pre;\"> <\/span>@id int,<br \/>\n<span style=\"white-space: pre;\"> <\/span>@name varchar(50)=null,<br \/>\n<span style=\"white-space: pre;\"> <\/span>@mobile bigint=null,<br \/>\n<span style=\"white-space: pre;\"> <\/span>@email varchar(50)=null,<br \/>\n<span style=\"white-space: pre;\"> <\/span>@password varchar(50)=null,<br \/>\n<span style=\"white-space: pre;\"> <\/span>@confirm_password varchar(50)=null<br \/>\n<span style=\"white-space: pre;\"> <\/span>)<br \/>\nAS<br \/>\nBEGIN<\/p>\n<p>begin<br \/>\n<span style=\"white-space: pre;\"> <\/span>if @option =1<br \/>\n<span style=\"white-space: pre;\"> <\/span>select name, mobile from student<br \/>\n<span style=\"white-space: pre;\"> <\/span>end<br \/>\n<span style=\"white-space: pre;\"> <\/span><br \/>\n<span style=\"white-space: pre;\"> <\/span>begin<br \/>\n<span style=\"white-space: pre;\"> <\/span>if @option = 2<br \/>\n<span style=\"white-space: pre;\"> <\/span>insert into student(id,name,mobile,email,password,confirm_password)values(@id,@name,@mobile,@email,@password,@confirm_password)<br \/>\n<span style=\"white-space: pre;\"> <\/span>end<br \/>\n<span style=\"white-space: pre;\"> <\/span><br \/>\n<span style=\"white-space: pre;\"> <\/span>begin<br \/>\n<span style=\"white-space: pre;\"> <\/span>if @option=3<br \/>\n<span style=\"white-space: pre;\"> <\/span>update student set name=@name,mobile=@mobile,email=@email,password=@password,confirm_password=@confirm_password where id=@id<br \/>\n<span style=\"white-space: pre;\"> <\/span>end<br \/>\n<span style=\"white-space: pre;\"> <\/span><br \/>\n<span style=\"white-space: pre;\"> <\/span>begin<br \/>\n<span style=\"white-space: pre;\"> <\/span>if @option = 4<br \/>\n<span style=\"white-space: pre;\"> <\/span>delete from student where id=@id<br \/>\n<span style=\"white-space: pre;\"> <\/span>end<br \/>\nEND<br \/>\n&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n&nbsp; protected void cmdInsert_Click(object sender, EventArgs e)<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (Page.IsValid)<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \/\/ GetStudentId();<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string str = &#8220;Exec QSPStudent 2,&#8221; + TextBox6.Text + &#8220;, &#8216;&#8221; + TextBox1.Text + &#8220;&#8216;, &#8221; + TextBox2.Text + &#8220;, &#8216;&#8221; + TextBox3.Text + &#8220;&#8216;, &#8216;&#8221; + TextBox4.Text + &#8220;&#8216;, &#8216;&#8221; + TextBox5.Text + &#8220;&#8216;&#8221;;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; dm.SqlExecuteQuery(str, 100);<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fillGrid();<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<\/p>\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; }<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Example: CREATE PROCEDURE dbo.QSPStudent ( @option int, @id int, @name varchar(50)=null, @mobile bigint=null, @email varchar(50)=null, @password varchar(50)=null, @confirm_password varchar(50)=null ) AS BEGIN begin if @option =1 select name, mobile from student end begin if @option = 2 insert into student(id,name,mobile,email,password,confirm_password)values(@id,@name,@mobile,@email,@password,@confirm_password) end begin if @option=3 update student set name=@name,mobile=@mobile,email=@email,password=@password,confirm_password=@confirm_password where id=@id end begin if @option = [&hellip;]<\/p>\n","protected":false},"author":43,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-90","post","type-post","status-publish","format-standard","hentry","category-blog"],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false},"uagb_author_info":{"display_name":"Himanshu Namdeo","author_link":"https:\/\/debuggersspace.com\/author\/admin\/"},"uagb_comment_info":0,"uagb_excerpt":"Example: CREATE PROCEDURE dbo.QSPStudent ( @option int, @id int, @name varchar(50)=null, @mobile bigint=null, @email varchar(50)=null, @password varchar(50)=null, @confirm_password varchar(50)=null ) AS BEGIN begin if @option =1 select name, mobile from student end begin if @option = 2 insert into student(id,name,mobile,email,password,confirm_password)values(@id,@name,@mobile,@email,@password,@confirm_password) end begin if @option=3 update student set name=@name,mobile=@mobile,email=@email,password=@password,confirm_password=@confirm_password where id=@id end begin if @option =&hellip;","_links":{"self":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts\/90"}],"collection":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/users\/43"}],"replies":[{"embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/comments?post=90"}],"version-history":[{"count":0,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/posts\/90\/revisions"}],"wp:attachment":[{"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/media?parent=90"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/categories?post=90"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/debuggersspace.com\/index.php\/wp-json\/wp\/v2\/tags?post=90"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}