<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3375969267344467</id><updated>2024-12-28T15:00:40.656-08:00</updated><category term="Add counter to your website for free"/><category term="Contact me for other files"/><category term="asp net gridview shopping cart"/><category term="asp.net shopping cart"/><category term="asp.net shopping cart open source"/><category term="asp.net shopping cart source code"/><category term="asp.net shopping cart tutorial"/><category term="free asp.net shopping cart"/><category term="free online shopping cart"/><category term="free shopping cart software"/><category term="shopping cart"/><category term="shopping cart script"/><category term="shopping carts for websites"/><title type='text'>Yash.net</title><subtitle type='html'>This blog is all about .net technology</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>21</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-6712161171351991755</id><published>2012-07-01T12:50:00.000-07:00</published><updated>2019-01-20T06:17:25.010-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp.net shopping cart"/><category scheme="http://www.blogger.com/atom/ns#" term="asp.net shopping cart tutorial"/><category scheme="http://www.blogger.com/atom/ns#" term="free asp.net shopping cart"/><category scheme="http://www.blogger.com/atom/ns#" term="free online shopping cart"/><category scheme="http://www.blogger.com/atom/ns#" term="shopping cart"/><category scheme="http://www.blogger.com/atom/ns#" term="shopping cart script"/><category scheme="http://www.blogger.com/atom/ns#" term="shopping carts for websites"/><title type='text'></title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;a href=&quot;http://www.skvzm.blogspot.com/&quot; target=&quot;_blank&quot;&gt;For common MS-WORD Shortcut keys&lt;/a&gt;Code for the Shopping cart without having database its basically for small applications where you have to be fast and you have small no. of items to be stored&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXzgH3sZ8Y_CwuxfEmpXi7LABBIxT0GInTGNzGtIr6c6wHf5AtB5Mg0pg1r4_8_cmrJIhVgWgPz_I9IGXZjdu0uFXV8Gt0vm4UazfBQ1g7S5MaFQ2-Nmd4Pu3YG-uewQIxnNy9-4OsbNY/s1600/untitled.bmp&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXzgH3sZ8Y_CwuxfEmpXi7LABBIxT0GInTGNzGtIr6c6wHf5AtB5Mg0pg1r4_8_cmrJIhVgWgPz_I9IGXZjdu0uFXV8Gt0vm4UazfBQ1g7S5MaFQ2-Nmd4Pu3YG-uewQIxnNy9-4OsbNY/s320/untitled.bmp&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
source code&lt;br /&gt;
&lt;br /&gt;
&amp;lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; &amp;nbsp;CodeFile=&quot;Default.aspx.cs&quot; Inherits=&quot;_Default&quot; %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &amp;gt;&lt;br /&gt;
&amp;lt;head id=&quot;Head1&quot; runat=&quot;server&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Web Cart &amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;amp;nbsp;&amp;lt;asp:Label ID=&quot;Label1&quot; runat=&quot;server&quot; Height=&quot;21px&quot; Text=&quot;Demo for Students By YASH&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Width=&quot;288px&quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;table&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td style=&quot;width: 100px&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:DropDownList ID=&quot;DropDownList1&quot; runat=&quot;server&quot; Width=&quot;198px&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:ListItem Value=&quot;25.50&quot;&amp;gt;LUX&amp;lt;/asp:ListItem&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:ListItem Value=&quot;45.60&quot;&amp;gt;MEDIMAX&amp;lt;/asp:ListItem&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:ListItem Value=&quot;34.75&quot;&amp;gt;CIBACA&amp;lt;/asp:ListItem&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:ListItem Value=&quot;43.50&quot;&amp;gt;CLOSEUP&amp;lt;/asp:ListItem&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/asp:DropDownList&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td style=&quot;width: 100px&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Button ID=&quot;btnAdd&quot; runat=&quot;server&quot; Text=&quot;Add to Cart&quot; OnClick=&quot;btnAdd_Click&quot; /&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td colspan=&quot;2&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;tr&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td colspan=&quot;2&quot; style=&quot;height: 176px&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:GridView ID=&quot;GridView1&quot;&lt;br /&gt;
&amp;nbsp; ShowFooter=&quot;true&quot; DataKeyNames=&quot;ProductId&quot;&lt;br /&gt;
&amp;nbsp; AutoGenerateColumns=&quot;false&quot; runat=&quot;server&quot;&amp;gt;&lt;br /&gt;
&amp;lt;Columns&amp;gt;&lt;br /&gt;
&amp;lt;asp:BoundField DataField=&quot;Productid&quot; HeaderText=&quot;Product Id&quot; /&amp;gt;&lt;br /&gt;
&amp;lt;asp:BoundField DataField=&quot;ProductName&quot; FooterText=&quot;Total&quot; HeaderText=&quot;Product Name&quot; /&amp;gt;&lt;br /&gt;
&amp;lt;asp:TemplateField HeaderText=&quot;Unit Price&quot; FooterStyle-Font-Bold=&quot;True&quot;&amp;gt;&lt;br /&gt;
&amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;%# GetUnitPrice(decimal.Parse(Eval(&quot;UnitPrice&quot;).ToString())).ToString(&quot;N2&quot;) %&amp;gt;&lt;br /&gt;
&amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;
&amp;lt;FooterTemplate&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;lt;%# GetTotal().ToString(&quot;N2&quot;) %&amp;gt;&lt;br /&gt;
&amp;lt;/FooterTemplate&amp;gt;&lt;br /&gt;
&amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;
&amp;lt;/Columns&amp;gt;&lt;br /&gt;
&amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/td&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/tr&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/table&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
C# code&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Configuration;&lt;br /&gt;
using System.Web;&lt;br /&gt;
using System.Web.Security;&lt;br /&gt;
using System.Web.UI;&lt;br /&gt;
using System.Web.UI.WebControls;&lt;br /&gt;
using System.Web.UI.WebControls.WebParts;&lt;br /&gt;
using System.Web.UI.HtmlControls;&lt;br /&gt;
&lt;br /&gt;
public partial class _Default : System.Web.UI.Page&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; private void DataTable()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataTable MyDT = new DataTable();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataRow MyRow;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ViewState[&quot;DataTable&quot;] == null)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyDT.Columns.Add(&quot;Productid&quot;, System.Type.GetType(&quot;System.Int32&quot;));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyDT.Columns.Add(&quot;ProductName&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyDT.Columns.Add(&quot;UnitPrice&quot;, System.Type.GetType(&quot;System.Decimal&quot;));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyRow = MyDT.NewRow();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyRow[0] = MyDT.Rows.Count + 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyRow[1] = DropDownList1.SelectedItem.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyRow[2] = DropDownList1.SelectedItem.Value;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyDT.Rows.Add(MyRow);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyDT = (DataTable)ViewState[&quot;DataTable&quot;];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyRow = MyDT.NewRow();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyRow[0] = MyDT.Rows.Count + 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyRow[1] = DropDownList1.SelectedItem.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyRow[2] = DropDownList1.SelectedItem.Value;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyDT.Rows.Add(MyRow);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ViewState[&quot;DataTable&quot;] = MyDT;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView1.DataSource = MyDT;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView1.DataBind();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected decimal TotalUnitPrice;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected decimal GetUnitPrice(decimal Price)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TotalUnitPrice += Price;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return Price;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected decimal GetTotal()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return TotalUnitPrice;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected void btnAdd_Click(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataTable();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh93AGU05Y6y_gt1cbVTrhruDVvdefXM-qUQtOHkL8wf17RDwEi5gCGmnaBjgIWCLvaPFoX-0oxHhB_q3ocUV3dCpX0ufNQTwn4kmD6FeGJAKWCidpwvrDDvlCmylUloHEJos_ApwTCIYA/s1600/untitled2.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh93AGU05Y6y_gt1cbVTrhruDVvdefXM-qUQtOHkL8wf17RDwEi5gCGmnaBjgIWCLvaPFoX-0oxHhB_q3ocUV3dCpX0ufNQTwn4kmD6FeGJAKWCidpwvrDDvlCmylUloHEJos_ApwTCIYA/s1600/untitled2.JPG&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
For common Ms-Word shortcut keys&lt;br /&gt;
&lt;br /&gt;
Www.skvzm.blogspot.com&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/6712161171351991755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2012/07/code-for-shopping-cart-without-having.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/6712161171351991755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/6712161171351991755'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2012/07/code-for-shopping-cart-without-having.html' title=''/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXzgH3sZ8Y_CwuxfEmpXi7LABBIxT0GInTGNzGtIr6c6wHf5AtB5Mg0pg1r4_8_cmrJIhVgWgPz_I9IGXZjdu0uFXV8Gt0vm4UazfBQ1g7S5MaFQ2-Nmd4Pu3YG-uewQIxnNy9-4OsbNY/s72-c/untitled.bmp" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-5689763819559218834</id><published>2012-07-01T03:44:00.001-07:00</published><updated>2013-08-15T13:03:16.557-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="asp net gridview shopping cart"/><category scheme="http://www.blogger.com/atom/ns#" term="asp.net shopping cart open source"/><category scheme="http://www.blogger.com/atom/ns#" term="asp.net shopping cart source code"/><category scheme="http://www.blogger.com/atom/ns#" term="free shopping cart software"/><title type='text'>How to Create Shopping Cart in asp.net(C#)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;div style=&quot;font-family: Verdana, Arial, sans-serif; font-size: 13px; text-align: -webkit-auto;&quot;&gt;
This article discusses how to create an order page and shopping cart page using GridView ASP.NET C# and SQL Server&lt;/div&gt;
&lt;ol style=&quot;font-family: Verdana, Arial, sans-serif; font-size: 13px; text-align: -webkit-auto;&quot;&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Create three tables:&lt;div style=&quot;font-size: 10pt;&quot;&gt;
&lt;img alt=&quot;Screenshot - P11.gif&quot; height=&quot;236&quot; src=&quot;http://www.codeproject.com/KB/database/GridView_order_page/P11.gif&quot; style=&quot;overflow-x: auto; overflow-y: auto;&quot; width=&quot;200&quot; /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Create a web Project&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Name of the Server can be anything.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;You can name anything to your Database.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Create an&amp;nbsp;&lt;i&gt;Images&lt;/i&gt;&amp;nbsp;Folder in the project solution&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Add some image file into the&amp;nbsp;&lt;i&gt;Images&lt;/i&gt;&amp;nbsp;folder&lt;/li&gt;
&lt;div style=&quot;font-size: 10pt;&quot;&gt;
&lt;img alt=&quot;Screenshot - P2.gif&quot; height=&quot;193&quot; src=&quot;http://www.codeproject.com/KB/database/GridView_order_page/P2.gif&quot; style=&quot;overflow-x: auto; overflow-y: auto;&quot; width=&quot;199&quot; /&gt;&lt;/div&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Rename the&amp;nbsp;&lt;i&gt;Default.aspx&lt;/i&gt;&amp;nbsp;web page to&amp;nbsp;&lt;i&gt;OrderPage.aspx&lt;/i&gt;&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Drag and drop&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;GridView&amp;nbsp;&lt;/code&gt;object from the toolbox on to the web form.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Create the following&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;GridView&amp;nbsp;&lt;/code&gt;Columns and set the&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;GridView AutoGenerateColumn&amp;nbsp;&lt;/code&gt;to&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;false&lt;/code&gt;.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Change the Header Text to change the name of the columns in GridView&lt;/li&gt;
&lt;div style=&quot;font-size: 10pt;&quot;&gt;
&lt;img alt=&quot;Screenshot - p3.gif&quot; height=&quot;406&quot; src=&quot;http://www.codeproject.com/KB/database/GridView_order_page/p3.gif&quot; style=&quot;overflow-x: auto; overflow-y: auto;&quot; width=&quot;514&quot; /&gt;&lt;/div&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Where&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;AddToCart&amp;nbsp;&lt;/code&gt;is a button, Picture ID, Title and Date Added are text fields and&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;PictureURL&amp;nbsp;&lt;/code&gt;is Image field.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;GridView&amp;nbsp;&lt;/code&gt;will look like this:&lt;div style=&quot;font-size: 10pt;&quot;&gt;
&lt;img alt=&quot;Screenshot - p4.gif&quot; height=&quot;190&quot; src=&quot;http://www.codeproject.com/KB/database/GridView_order_page/p4.gif&quot; style=&quot;overflow-x: auto; overflow-y: auto;&quot; width=&quot;542&quot; /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;When the order page is loaded, all the items have to be loaded to the&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;GridView&amp;nbsp;&lt;/code&gt;for the user to select, copy the following code to the load page event:&lt;pre lang=&quot;cs&quot; style=&quot;background-color: #fbedbb; border-bottom-color: rgb(251, 237, 187); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(251, 237, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(251, 237, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(251, 237, 187); border-top-style: solid; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 9pt; overflow-x: auto; overflow-y: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; Sel = &lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Select * from ItemTable&quot;&lt;/span&gt;; 
SqlConnection Con = &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; SqlConnection(Cn); 
SqlCommand cmd = &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; SqlCommand(Sel, Con); 
Con.Open(); 
DataTable dt = &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DataTable(); 
dt.Columns.Add(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DataColumn(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;PictureID&quot;&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;))); 
dt.Columns.Add(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DataColumn(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;PictureURL&quot;&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;))); 
dt.Columns.Add(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DataColumn(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Title&quot;&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;))); 
dt.Columns.Add(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DataColumn(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;DateAdded&quot;&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(DateTime))); 
SqlDataReader reader = cmd.ExecuteReader(); 
&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;while&lt;/span&gt; (reader.Read()) 
{ 
DataRow dr = dt.NewRow(); 
dr[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;PictureID&quot;&lt;/span&gt;] = Convert.ToInt32(reader[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;PictureId&quot;&lt;/span&gt;]); 
dr[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;PictureURL&quot;&lt;/span&gt;] = ResolveUrl(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;~/Images/&quot;&lt;/span&gt; +reader[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;PictureURL&quot;&lt;/span&gt;]); 
dr[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Title&quot;&lt;/span&gt;] = reader[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Title&quot;&lt;/span&gt;]; 
dr[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;DateAdded&quot;&lt;/span&gt;] = reader[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;DateAdded&quot;&lt;/span&gt;]; 
dt.Rows.Add(dr); 
} 
Con.Close(); 
GridView1.DataSource = dt; 
GridView1.DataBind(); &lt;/pre&gt;
&lt;div style=&quot;font-size: 10pt;&quot;&gt;
Where Cn Is the connection string.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Enter some data to the SQL table:&lt;div style=&quot;font-size: 10pt;&quot;&gt;
&lt;img alt=&quot;Screenshot - p5.gif&quot; height=&quot;100&quot; src=&quot;http://www.codeproject.com/KB/database/GridView_order_page/p5.gif&quot; style=&quot;overflow-x: auto; overflow-y: auto;&quot; width=&quot;200&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 10pt;&quot;&gt;
&lt;img alt=&quot;Screenshot - p6.gif&quot; height=&quot;108&quot; src=&quot;http://www.codeproject.com/KB/database/GridView_order_page/p6.gif&quot; style=&quot;overflow-x: auto; overflow-y: auto;&quot; width=&quot;506&quot; /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Build and run the application.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;The following result will be displayed:&lt;div style=&quot;font-size: 10pt;&quot;&gt;
&lt;img alt=&quot;Screenshot - p7.gif&quot; height=&quot;359&quot; src=&quot;http://www.codeproject.com/KB/database/GridView_order_page/p7.gif&quot; style=&quot;overflow-x: auto; overflow-y: auto;&quot; width=&quot;543&quot; /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;AddToCart&amp;nbsp;&lt;/code&gt;button click event:&lt;div style=&quot;font-size: 10pt;&quot;&gt;
&lt;img alt=&quot;Screenshot - p8.gif&quot; height=&quot;196&quot; src=&quot;http://www.codeproject.com/KB/database/GridView_order_page/p8.gif&quot; style=&quot;overflow-x: auto; overflow-y: auto;&quot; width=&quot;250&quot; /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 10pt;&quot;&gt;
Set the&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;AddToCart&amp;nbsp;&lt;/code&gt;button property.&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Add this to the&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;GridView&amp;nbsp;&lt;/code&gt;property using the source page or the HTML page&lt;br /&gt;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;OnRowCommand=&quot;GridView1_RowCommand&quot;&lt;/code&gt;&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Add these lines of code to the page code behind:&lt;pre lang=&quot;cs&quot; style=&quot;background-color: #fbedbb; border-bottom-color: rgb(251, 237, 187); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(251, 237, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(251, 237, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(251, 237, 187); border-top-style: solid; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 9pt; overflow-x: auto; overflow-y: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; GridView1_RowCommand(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;object&lt;/span&gt; sender, GridViewCommandEventArgs e) 
{ 
&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (e.CommandName == &lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;AddToCart&quot;&lt;/span&gt;) 
{ 
&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; index = Convert.ToInt32(e.CommandArgument); 
GridViewRow row = GridView1.Rows[index]; 
AddShopCart(row.Cells[&lt;span class=&quot;code-digit&quot; style=&quot;color: navy;&quot;&gt;1&lt;/span&gt;].Text.ToString()); 
} 
} &lt;/pre&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;After you click the&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;AddToCart&amp;nbsp;&lt;/code&gt;button, you&amp;nbsp;need to move the item to the shopping cart. To do that, you need to write code to make a data entry to&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;OrderTable&lt;/code&gt;, since&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;ItemId&amp;nbsp;&lt;/code&gt;is unique. Based on&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;ItemId&amp;nbsp;&lt;/code&gt;we insert a data entry to the&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;OrderTable&lt;/code&gt;.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Before we make an&amp;nbsp;entry to the table we need order Number, we can get the order number from&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;ControlTable&amp;nbsp;&lt;/code&gt;since&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;ControlTable&amp;nbsp;&lt;/code&gt;holds the last used order number.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;The method to insert selected item to shopping cart will get the last used order number from&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;ControlTable&lt;/code&gt;, and after inserting the values to the&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;OrderTable&amp;nbsp;&lt;/code&gt;will update the order number in the&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;ControlTable&lt;/code&gt;.&lt;pre lang=&quot;cs&quot; style=&quot;background-color: #fbedbb; border-bottom-color: rgb(251, 237, 187); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(251, 237, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(251, 237, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(251, 237, 187); border-top-style: solid; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 9pt; overflow-x: auto; overflow-y: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; AddShopCart(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; ItemId) 
{ 
&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; ord = OrderNumber(); 
&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (ord != &lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Bad order&quot;&lt;/span&gt;) 
{ 
&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; ordernumber = Convert.ToInt32(ord); 
ordernumber += &lt;span class=&quot;code-digit&quot; style=&quot;color: navy;&quot;&gt;1&lt;/span&gt;; 
SqlConnection C_n = &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; SqlConnection(Cn); 
SqlCommand cm = &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; SqlCommand(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Insert INTO OrderTable VALUES
 (&#39;&quot;&lt;/span&gt; + ordernumber + &lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&#39;, &#39;&quot;&lt;/span&gt; + ItemId + &lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&#39;, &#39;&quot;&lt;/span&gt; + &lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;101&quot;&lt;/span&gt; + 
 &lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&#39;, &#39;&quot;&lt;/span&gt; + Convert.ToDateTime(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;2/19/2007&quot;&lt;/span&gt;) + &lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&#39;,&#39;&quot;&lt;/span&gt; + &lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;1&quot;&lt;/span&gt; + &lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&#39;)&quot;&lt;/span&gt;, C_n); 
C_n.Open(); 
SqlDataReader dr = cm.ExecuteReader(); 
C_n.Close(); 
UpdateOrderNumber(ordernumber); 
} 
} &lt;/pre&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;The method to get the last used order number.&lt;pre lang=&quot;cs&quot; style=&quot;background-color: #fbedbb; border-bottom-color: rgb(251, 237, 187); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(251, 237, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(251, 237, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(251, 237, 187); border-top-style: solid; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 9pt; overflow-x: auto; overflow-y: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; OrderNumber() 
{ 
SqlConnection Or_Cn = &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; SqlConnection(Cn); 
SqlCommand Or_Cm = &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; SqlCommand(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Select OrderNumber from ControlTable&quot;&lt;/span&gt;, Or_Cn); 
Or_Cn.Open(); 
SqlDataReader Or_rd = Or_Cm.ExecuteReader(); 
&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;if&lt;/span&gt; (Or_rd.Read()) 
{ 
&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; Or_rd[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;OrderNumber&quot;&lt;/span&gt;].ToString(); 
} 
&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;else&lt;/span&gt; 
{ 
&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Bad order&quot;&lt;/span&gt;; 
} 
} &lt;/pre&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;The method to update the order number in the&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;ControlTable&lt;/code&gt;:&lt;pre lang=&quot;cs&quot; style=&quot;background-color: #fbedbb; border-bottom-color: rgb(251, 237, 187); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(251, 237, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(251, 237, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(251, 237, 187); border-top-style: solid; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 9pt; overflow-x: auto; overflow-y: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;void&lt;/span&gt; UpdateOrderNumber(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;int&lt;/span&gt; UpdatedNumber) 
{ 
SqlConnection Op_Cn = &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; SqlConnection(Cn); 
SqlCommand Op_Cm = &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; SqlCommand
 (&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Update ControlTable Set OrderNumber=&quot;&lt;/span&gt; + UpdatedNumber, Op_Cn); 
Op_Cn.Open(); 
SqlDataReader Op_rd = Op_Cm.ExecuteReader(); 
Op_Cn.Close(); 
} &lt;/pre&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Add new page to the project and name it&amp;nbsp;&lt;i&gt;ShoppingCart.aspx&lt;/i&gt;.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Drag and drop&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;GridView&amp;nbsp;&lt;/code&gt;object from the toolbox on to the web form.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Create the following&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;GridView&amp;nbsp;&lt;/code&gt;columns and set the&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;GridView AutoGenerateColumn&amp;nbsp;&lt;/code&gt;to&amp;nbsp;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;false&lt;/code&gt;.&lt;div style=&quot;font-size: 10pt;&quot;&gt;
&lt;img alt=&quot;Screenshot - p9.gif&quot; height=&quot;409&quot; src=&quot;http://www.codeproject.com/KB/database/GridView_order_page/p9.gif&quot; style=&quot;overflow-x: auto; overflow-y: auto;&quot; width=&quot;515&quot; /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Where Delete is a button, Picture ID, Title, Price and Date Added are text fields and PictureURL is Image field.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;&lt;code style=&quot;color: #990000; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 11pt;&quot;&gt;GridView&amp;nbsp;&lt;/code&gt;will look like this:&lt;div style=&quot;font-size: 10pt;&quot;&gt;
&lt;img alt=&quot;Screenshot - p10.gif&quot; height=&quot;208&quot; src=&quot;http://www.codeproject.com/KB/database/GridView_order_page/p10.gif&quot; style=&quot;overflow-x: auto; overflow-y: auto;&quot; width=&quot;556&quot; /&gt;&lt;/div&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;Under page load event, copy the following code:&lt;pre lang=&quot;cs&quot; style=&quot;background-color: #fbedbb; border-bottom-color: rgb(251, 237, 187); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(251, 237, 187); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(251, 237, 187); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(251, 237, 187); border-top-style: solid; border-top-width: 1px; font-family: &#39;Courier New&#39;, Courier, mono; font-size: 9pt; overflow-x: auto; overflow-y: auto; padding-bottom: 6px; padding-left: 6px; padding-right: 6px; padding-top: 6px; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt; Sel = &lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Select a.* from ItemTable as a INNER JOIN 
  OrderTable as b ON a.PictureId=b.ItemId&quot;&lt;/span&gt;; 
SqlConnection Con = &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; SqlConnection(Cn); 
SqlCommand cmd = &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; SqlCommand(Sel, Con); 
Con.Open(); 
DataTable dt = &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DataTable(); 
dt.Columns.Add(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DataColumn(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;PictureID&quot;&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;))); 
dt.Columns.Add(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DataColumn(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Title&quot;&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;))); 
dt.Columns.Add(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DataColumn(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Price&quot;&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;))); 
dt.Columns.Add(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DataColumn(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;DateAdded&quot;&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(DateTime))); 
dt.Columns.Add(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;new&lt;/span&gt; DataColumn(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;PictureURL&quot;&lt;/span&gt;, &lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;typeof&lt;/span&gt;(&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;))); 
SqlDataReader reader = cmd.ExecuteReader(); 
&lt;span class=&quot;code-keyword&quot; style=&quot;color: blue;&quot;&gt;while&lt;/span&gt; (reader.Read()) 
{ 
DataRow dr = dt.NewRow(); 
dr[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;PictureID&quot;&lt;/span&gt;] = Convert.ToInt32(reader[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;PictureId&quot;&lt;/span&gt;]); 
dr[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Title&quot;&lt;/span&gt;] = reader[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Title&quot;&lt;/span&gt;]; 
dr[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Price&quot;&lt;/span&gt;] = reader[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;Price&quot;&lt;/span&gt;]; 
dr[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;DateAdded&quot;&lt;/span&gt;] = reader[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;DateAdded&quot;&lt;/span&gt;]; 
dr[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;PictureURL&quot;&lt;/span&gt;] = ResolveUrl(&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;~/Images/&quot;&lt;/span&gt; + reader[&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot; style=&quot;color: purple;&quot;&gt;PictureURL&quot;&lt;/span&gt;]); 
dt.Rows.Add(dr); 
} 
Con.Close(); 
GridView1.DataSource = dt; 
GridView1.DataBind(); &lt;/pre&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt;&quot;&gt;F5&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/5689763819559218834/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2012/07/how-to-create-shopping-cart-in-aspnetc.html#comment-form' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/5689763819559218834'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/5689763819559218834'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2012/07/how-to-create-shopping-cart-in-aspnetc.html' title='How to Create Shopping Cart in asp.net(C#)'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-6619139958350538271</id><published>2012-06-29T13:10:00.000-07:00</published><updated>2012-06-29T13:10:08.410-07:00</updated><title type='text'>How to Create Triggers in Sql server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 13px;&quot;&gt;CREATE TRIGGER Management.ForCustomers
ON Management.Customers
AFTER INSERT
AS
BEGIN
    INSERT INTO Management.DatabaseOperations
    VALUES(default, N&#39;Customers&#39;, SUSER_SNAME(), 
        N&#39;Processed a deposit&#39;, GETDATE())
END
GO&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/6619139958350538271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2012/06/how-to-create-triggers-in-sql-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/6619139958350538271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/6619139958350538271'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2012/06/how-to-create-triggers-in-sql-server.html' title='How to Create Triggers in Sql server'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-1910208721325254431</id><published>2012-06-29T13:09:00.000-07:00</published><updated>2012-06-29T13:09:14.997-07:00</updated><title type='text'>How to Create Stored Procedures or What is Stored Procedures in sql server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;span style=&quot;font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13px; text-align: justify;&quot;&gt;We have had an introduction to some types of actions that could be performed on a database. These actions were called functions. A function is used to perform a calculation and produce a regular value based on a data type. In fact, the default formula of a function doesn&#39;t allow it to produce a list of values. If you want a function that produces a table, you must create a&lt;/span&gt;&lt;a href=&quot;http://www.functionx.com/sqlserver/Lesson29.htm#tvf&quot; style=&quot;color: green; font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: justify; text-decoration: none;&quot;&gt;table-valued function&lt;/a&gt;&lt;span style=&quot;font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13px; text-align: justify;&quot;&gt;, but you may not want to deal with some of its rules. In reality, you cannot create a regular function that returns a&amp;nbsp;&lt;/span&gt;&lt;strong style=&quot;font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13px; text-align: justify;&quot;&gt;SELECT&lt;/strong&gt;&lt;span style=&quot;font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13px; text-align: justify;&quot;&gt;&amp;nbsp;query. Of course, the alternative is to create a view.&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13px; text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div align=&quot;center&quot; style=&quot;font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;center&gt;&lt;table border=&quot;0&quot; style=&quot;width: 900px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td rowspan=&quot;2&quot; style=&quot;font-size: 10pt;&quot; valign=&quot;top&quot; width=&quot;680&quot;&gt;&lt;span name=&quot;KonaBody&quot;&gt;&lt;ol&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Start the computer and log in&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Launch&amp;nbsp;&lt;a class=&quot;kLink&quot; href=&quot;http://www.functionx.com/sqlserver/Lesson35.htm#&quot; id=&quot;KonaLink2&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; border-bottom-color: transparent !important; border-bottom-style: none !important; border-bottom-width: 0px !important; border-image: initial !important; border-left-color: transparent !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: transparent !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: transparent !important; border-top-style: none !important; border-top-width: 0px !important; bottom: 0px; color: blue; cursor: pointer; display: inline !important; font-family: inherit !important; font-size: inherit !important; left: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: 0px; top: 0px;&quot;&gt;&lt;span style=&quot;color: blue; font-family: inherit !important; font-size: inherit !important; position: static;&quot;&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;Microsoft&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;SQL&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;Server and click Connect&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Open the&amp;nbsp;&lt;a href=&quot;http://www.functionx.com/sqlserver/codes/WattsALoan1.sql&quot; style=&quot;color: green; font-size: 10pt; font-weight: bold; text-decoration: none;&quot;&gt;WattsALoan1.sql&lt;/a&gt;&amp;nbsp;file (&lt;a href=&quot;http://www.functionx.com/sqlserver/codes/WattsALoan1.txt&quot; style=&quot;color: green; font-size: 10pt; font-weight: bold; text-decoration: none;&quot;&gt;Watts A Loan&lt;/a&gt;)&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To create the database and its objects, right-click inside the document and click Execute&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Close the Query window&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;In the Object Explorer, expand the Databases node and expand WattsALoan1&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Right-click Database Diagrams -&amp;gt; New Database Diagram&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;When the message box comes up, read it and click Yes&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Right-click Database Diagram and click New Database Diagram&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Read the message and click Yes&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;In the dialog box, double-click each table and, when all tables have been added, click Close&lt;br /&gt;&lt;br /&gt;&lt;img alt=&quot;Watts A Loan - Diagram&quot; border=&quot;0&quot; height=&quot;620&quot; src=&quot;http://www.functionx.com/sqlserver/diagrams/diagram6.gif&quot; width=&quot;476&quot; /&gt;&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Close the diagram&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;When asked whether you want to save it, click Yes&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Set the name to&amp;nbsp;&lt;b&gt;dgmWattsALoan1&lt;/b&gt;&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Click OK&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;In the Object Explorer, right-click WattsALoan1 and click New Query&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To see a list of payments made on different loans, type the following:&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt;&quot;&gt;SELECT ALL * FROM Loans.Payments;
GO&lt;/pre&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To see the result, on the main menu, click Query -&amp;gt; Execute&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Click inside the top section of the Query window and press Ctrl + A&lt;/li&gt;
&lt;/ol&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;CreateProc&quot;&gt;&lt;/a&gt;Creating a Stored Procedure&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
To create a stored procedure:&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;In the Object Explorer, expand the database for which you want to create the stored procedure, expand its Programmability node, right-click Stored Procedures, and click New Stored Procedure... A Query window with a skeleton syntax would be displayed. You can then modify that code using the techniques we will learn in this lesson&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Open an empty Query window associated with the database for which you want to create the stored procedure and display the Templates Explorer. In the Templates Explorer, expand the Stored Procedure node. Drag Create Stored Procedure and drop it in the Query window&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Open an empty Query window associated with the database for which you want to create the stored procedure and enter the necessary code&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
The simplest syntax to create a stored procedure in Transact-SQL is:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROC/PROCEDURE [&lt;em&gt;SchemaName&lt;/em&gt;.]&lt;i&gt;ProcedureName&lt;/i&gt;
AS
&lt;i&gt;Body of the Procedure&lt;/i&gt;&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
To create a stored procedure, start with the&amp;nbsp;&lt;b&gt;CREATE PROCEDURE&lt;/b&gt;&amp;nbsp;expression. You can also use&lt;b&gt;CREATE PROC&lt;/b&gt;. Both expressions produce the same result. Like everything in your database, you must name your stored procedure:&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;The name of a procedure can be any string that follows the rules we reviewed for&amp;nbsp;&lt;a href=&quot;http://www.functionx.com/sqlserver/Lesson09.htm#Name&quot; style=&quot;color: green; font-size: 10pt; font-weight: bold; text-decoration: none;&quot;&gt;naming the functions&lt;/a&gt;&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Refrain from starting the name of a stored procedure with&amp;nbsp;&lt;b&gt;sp_&lt;/b&gt;&amp;nbsp;because it could conflict with some of the stored procedures that already ship with&amp;nbsp;&lt;a class=&quot;kLink&quot; href=&quot;http://www.functionx.com/sqlserver/Lesson35.htm#&quot; id=&quot;KonaLink3&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; border-bottom-color: transparent !important; border-bottom-style: none !important; border-bottom-width: 0px !important; border-image: initial !important; border-left-color: transparent !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: transparent !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: transparent !important; border-top-style: none !important; border-top-width: 0px !important; bottom: 0px; color: blue; cursor: pointer; display: inline !important; font-family: inherit !important; font-size: inherit !important; left: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: 0px; top: 0px;&quot;&gt;&lt;span style=&quot;color: blue; font-family: inherit !important; font-size: inherit !important; position: static;&quot;&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;Microsoft&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;SQL&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;Server&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
When creating a stored procedure, you can precede its name by a schema name. After the name of the procedure, type the&amp;nbsp;&lt;b&gt;AS&lt;/b&gt;&amp;nbsp;keyword. The section, group of words, or group of lines after the&amp;nbsp;&lt;b&gt;AS&lt;/b&gt;&amp;nbsp;keyword is the body of the stored procedure. It states what you want the procedure to do or what you want it to produce. It is important to keep in mind that there are many other issues related to creating a stored procedure but we will ignore them for now.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Probably the simplest procedure you can create would consist of selecting fields from a table. This is done with the&amp;nbsp;&lt;b&gt;SELECT&lt;/b&gt;&amp;nbsp;operator. It uses the techniques we reviewed for data selection. For example, to create a stored procedure that would hold a list of students from a table named Students, you would create the procedure as follows:&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Here is an example of creating a stored procedure:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROCEDURE Registration.GetStudentIdentification
AS
BEGIN
    SELECT FirstName, LastName, DateOfBirth, Gender
    FROM Registration.Students
END
GO&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Although you can use the * to select all fields of a table, instead, you should always create the list of columns, even if you plan to use all columns of a table.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Besides&amp;nbsp;&lt;b&gt;SELECT&lt;/b&gt;&amp;nbsp;operations, in a stored procedure, you can perform any of the database operations we have applied so far. These include creating and maintaining records, etc.&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;exotitle&quot; style=&quot;color: #cc3300; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
&lt;img alt=&quot;Practical Learning&quot; border=&quot;0&quot; height=&quot;18&quot; src=&quot;http://www.functionx.com/images/practical1.gif&quot; width=&quot;19&quot; /&gt;Practical Learning: Creating a Stored Procedure&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#CC3300&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;ol&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To start a stored procedure, type the following:&lt;br /&gt;&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt;&quot;&gt;CREATE PROCEDURE Management.ShowInformation
AS
    SELECT ALL * FROM Loans.Types;
    SELECT ALL * FROM Accounts.Customers;
GO&lt;/pre&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To create the stored procedure, on the main menu, click Query -&amp;gt; Execute&lt;/li&gt;
&lt;/ol&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;CreateProc0&quot;&gt;&lt;/a&gt;Executing a Stored Procedure&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
After creating a stored procedure, you must store it as an object in your database. To do this visually, on the&amp;nbsp;&lt;a class=&quot;kLink&quot; href=&quot;http://www.functionx.com/sqlserver/Lesson35.htm#&quot; id=&quot;KonaLink4&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; border-bottom-color: transparent !important; border-bottom-style: none !important; border-bottom-width: 0px !important; border-image: initial !important; border-left-color: transparent !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: transparent !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: transparent !important; border-top-style: none !important; border-top-width: 0px !important; bottom: 0px; color: blue; cursor: pointer; display: inline !important; font-family: inherit !important; font-size: inherit !important; left: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: 0px; top: 0px;&quot;&gt;&lt;span style=&quot;color: blue; font-family: inherit !important; font-size: inherit !important; position: static;&quot;&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;SQL&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;Editor&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;toolbar, you can click the Execute button&amp;nbsp;&lt;img alt=&quot;Execute&quot; border=&quot;0&quot; height=&quot;22&quot; src=&quot;http://www.functionx.com/sqlserver/buttons/execute1.gif&quot; width=&quot;65&quot; /&gt;. If the code of the stored procedure is right, it would be created:&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Stored Procedure&quot; height=&quot;301&quot; src=&quot;http://www.functionx.com/sqlserver/queries/sp1.gif&quot; width=&quot;515&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Also, a new node for its name would be added to the Stored Procedures section of the database.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
To get the results of creating a stored procedure, you must execute it (in other words, to use a stored procedure, you must call it). To execute a stored procedure, you use the&amp;nbsp;&lt;b&gt;EXECUTE&lt;/b&gt;&amp;nbsp;keyword followed by the name of the procedure. Although there are some other issues related to executing a stored procedure, for now, we will consider that the simplest syntax to call a procedure is:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;EXEC/EXECUTE [&lt;em&gt;SchemaName&lt;/em&gt;.]&lt;i&gt;ProcedureName&lt;/i&gt;&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
If you have a stored procedure named GetStudentIdentification, to execute it, you would type:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;EXECUTE GetStudentIdentification&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
You can also precede the name of the procedure with its schema. Here is an example:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;EXECUTE &lt;span style=&quot;color: red;&quot;&gt;Registration.&lt;/span&gt;GetStudentIdentification;&lt;/pre&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Stored Procedure&quot; height=&quot;509&quot; src=&quot;http://www.functionx.com/sqlserver/queries/sp2.gif&quot; width=&quot;515&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
You can also precede the name of the schema with the name of the database. Here is an example:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;EXECUTE &lt;span style=&quot;color: red;&quot;&gt;rosh.&lt;/span&gt;Registration.GetStudentIdentification;&lt;/pre&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;exotitle&quot; style=&quot;color: #cc3300; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
&lt;img alt=&quot;Practical Learning&quot; border=&quot;0&quot; height=&quot;18&quot; src=&quot;http://www.functionx.com/images/practical1.gif&quot; width=&quot;19&quot; /&gt;Practical Learning: Executing a Stored Procedure&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#CC3300&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;ol&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Click inside the top section of the Query window and press Ctrl + A to select everything&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To execute the stored procedure, type the following&lt;br /&gt;&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt;&quot;&gt;EXECUTE Management.ShowInformation;
GO&lt;/pre&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To execute the stored procedure, right-click inside the top section of the Query window and click Execute&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Click inside the top section of the Query window and press Ctrl + A&lt;/li&gt;
&lt;/ol&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;paratitle&quot; style=&quot;color: red; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 16pt; font-weight: bold;&quot;&gt;
Stored Procedure and Permissions&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#FF0000&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&amp;nbsp;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
Introduction&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
To visually manage the permissions of a stored procedure, in the Object Inspector, right-click it and click Properties. In the left frame, click Permissions. In the right section of the dialog box, get a user name and view the available permissions in the&amp;nbsp;&lt;a class=&quot;kLink&quot; href=&quot;http://www.functionx.com/sqlserver/Lesson35.htm#&quot; id=&quot;KonaLink5&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; border-bottom-color: transparent !important; border-bottom-style: none !important; border-bottom-width: 0px !important; border-image: initial !important; border-left-color: transparent !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: transparent !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: transparent !important; border-top-style: none !important; border-top-width: 0px !important; bottom: 0px; color: blue; cursor: pointer; display: inline !important; font-family: inherit !important; font-size: inherit !important; left: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: 0px; top: 0px;&quot;&gt;&lt;span style=&quot;color: blue; font-family: inherit !important; font-size: inherit !important; position: static;&quot;&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;bottom&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;&lt;/span&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;section&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;:&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
&lt;img alt=&quot;Stored Procedure and Permissions&quot; height=&quot;632&quot; src=&quot;http://www.functionx.com/sqlserver/dlgboxes/spp1.gif&quot; width=&quot;704&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
As you can see, a stored procedure does not have many permissions on its own. Still, permissions on stored procedures can get complicated because of the interactions a stored procedure has with the objects it uses.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
To start, a developer who has to create one ore more stored procedures must have the&amp;nbsp;&lt;strong&gt;CREATE PROCEDURE&lt;/strong&gt;&amp;nbsp;permission on the database that will own the procedure. Also, he or she must have the&lt;strong&gt;ALTER&lt;/strong&gt;&amp;nbsp;permissions. You must also coordinate the permissions of the user on the objects used by the stored procedure.&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
Executing On Behalf of an Account&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
If a user is lacking some permissions when executing a stored procedure, he cannot use the result(s) of that procedure. As an alternative, when creating a certain stored procedure, you can specify the user account that will be used to execute the procedure. To give this instruction, before the&amp;nbsp;&lt;strong&gt;AS&lt;/strong&gt;&amp;nbsp;keyword permission, type&amp;nbsp;&lt;strong&gt;WITH EXECEUTE AS&lt;/strong&gt;&amp;nbsp;followed by the user name that will be used. The formula to follow is:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROC/PROCEDURE [&lt;em&gt;SchemaName&lt;/em&gt;.]&lt;i&gt;ProcedureName&lt;/i&gt;
&lt;span class=&quot;codered&quot; style=&quot;color: red; font-size: 10pt;&quot;&gt;WITH EXECUTE AS&lt;/span&gt; &lt;i&gt;Option&lt;/i&gt;
AS
&lt;i&gt;Body of the Procedure&lt;/i&gt;&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
The options are:&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;If you want your own account to be used, use&amp;nbsp;&lt;strong&gt;WITH EXECUTE AS SELF&lt;/strong&gt;. This is the default for a stored procedure. In this case, your user name will be stored with the procedure and the&amp;nbsp;&lt;a class=&quot;kLink&quot; href=&quot;http://www.functionx.com/sqlserver/Lesson35.htm#&quot; id=&quot;KonaLink6&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; border-bottom-color: transparent !important; border-bottom-style: none !important; border-bottom-width: 0px !important; border-image: initial !important; border-left-color: transparent !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: transparent !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: transparent !important; border-top-style: none !important; border-top-width: 0px !important; bottom: 0px; color: blue; cursor: pointer; display: inline !important; font-family: inherit !important; font-size: inherit !important; left: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: 0px; top: 0px;&quot;&gt;&lt;span style=&quot;color: blue; font-family: inherit !important; font-size: inherit !important; position: static;&quot;&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;database&lt;/span&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;engine&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;will call it when the sotred procedure is executed.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;If you want the account of the user who is executing the procedure to be used, use&amp;nbsp;&lt;strong&gt;WITH EXECUTE AS CALLER&lt;/strong&gt;. In this case, when the user starts executing the procedure, the database engine will check whether the user has the appropriate permissions. If so, the stored procedure would execute. Otherwise, he will be denied.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;If you want the account of the owner of the database to be used, use&amp;nbsp;&lt;strong&gt;WITH EXECUTE AS OWNER&lt;/strong&gt;.&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;If you want to specify the account that will be used when executing the schema, use&amp;nbsp;&lt;strong&gt;WITH EXECUTE AS&lt;/strong&gt;, followed by the user name. Here is an example:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE USER Patricia FOR LOGIN [Central\pkatts];
GO
CREATE PROCEDURE Registration.GetContactInformation
&lt;span class=&quot;codered&quot; style=&quot;color: red; font-size: 10pt;&quot;&gt;WITH EXECUTE AS N&#39;Patricia&#39;&lt;/span&gt;
AS
SET NOCOUNT ON
    SELECT FirstName, LastName, ParentsNames
    FROM Registration.Students;    
GO&lt;/pre&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;paratitle&quot; style=&quot;color: red; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 16pt; font-weight: bold;&quot;&gt;
Managing Procedures&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#FF0000&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&amp;nbsp;&amp;nbsp;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
Introduction&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
When a stored procedure executes, the database engine must keep sending messages back and forth between the server and the client. These relentless interactions create overhead on the processing and in most cases are not necessary. To avoid them, after the AS keyword, add a SET NOCOUNT ON expression before starting the body of the stored procedure. The formula to follow is:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROC/PROCEDURE [&lt;em&gt;SchemaName&lt;/em&gt;.]&lt;i&gt;ProcedureName&lt;/i&gt;
AS
&lt;span style=&quot;color: red;&quot;&gt;SET NOCOUNT ON&lt;/span&gt;
&lt;i&gt;Body of the Procedure&lt;/i&gt;&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Here is an example:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROCEDURE Registration.GetIdentification
AS
&lt;span style=&quot;color: red;&quot;&gt;SET NOCOUNT ON&lt;/span&gt;
BEGIN
    SELECT FirstName, LastName, DateOfBirth, Gender
    FROM Registration.Students
END
GO&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Although you can create and use a stored procedure without specifying a schema, it is recommended that you always use a schema. In fact, you should always create your own schema in your database and create your stored procedure in it.&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;AlterProc0&quot;&gt;&lt;/a&gt;Encrypting the Code of a Stored Procedure&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
As mentioned already, when you create a stored procedure, it becomes an object in the Object Inspector and its code is available. If you want to encrypt that code as it is stored in the database, add a&amp;nbsp;&lt;strong&gt;WITH ENCRYPTION&lt;/strong&gt;&amp;nbsp;expression before the&amp;nbsp;&lt;strong&gt;AS&lt;/strong&gt;&amp;nbsp;keyword. The formula to follow is:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROC/PROCEDURE [&lt;em&gt;SchemaName&lt;/em&gt;.]&lt;i&gt;ProcedureName&lt;/i&gt;
&lt;span style=&quot;color: red;&quot;&gt;WITH ENCRYPTION&lt;/span&gt;
AS
&lt;i&gt;Body of the Procedure&lt;/i&gt;&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Here is an example:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROCEDURE Registration.GetStudentIdentification4
&lt;span class=&quot;codered&quot; style=&quot;color: red; font-size: 10pt;&quot;&gt;WITH ENCRYPTION&lt;/span&gt;
AS
SET NOCOUNT ON
    SELECT FirstName, LastName, DateOfBirth, Gender
    FROM Registration.Students;    
GO&lt;/pre&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;AlterProc&quot;&gt;&lt;/a&gt;Modifying a Stored Procedure&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
As a regular Microsoft SQL&amp;nbsp;&lt;a class=&quot;kLink&quot; href=&quot;http://www.functionx.com/sqlserver/Lesson35.htm#&quot; id=&quot;KonaLink7&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; border-bottom-color: transparent !important; border-bottom-style: none !important; border-bottom-width: 0px !important; border-image: initial !important; border-left-color: transparent !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: transparent !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: transparent !important; border-top-style: none !important; border-top-width: 0px !important; bottom: 0px; color: blue; cursor: pointer; display: inline !important; font-family: inherit !important; font-size: inherit !important; left: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: 0px; top: 0px;&quot;&gt;&lt;span style=&quot;color: blue; font-family: inherit !important; font-size: inherit !important; position: static;&quot;&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;Server&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;database&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;object, you can modify a stored procedure without recreating it. To do this:&lt;/div&gt;
&lt;ul&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;In the Object Explorer, right-click the procedure and click Modify&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;In the Object Explorer, right-click the procedure, position the mouse on Script Stored Procedure As -&amp;gt; ALTER To -&amp;gt; New Query Editor Window&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Open an empty Query window associated with the database that contains the stored procedure. From the Templates Explorer, expand Stored Procedure. Drag the Alter Stored Procedure node and drop it in the empty Query window&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
In each case, a skeleton code would be generated for you. You can then edit it to create a new version of your stored procedure. After editing the code, you can execute the&amp;nbsp;&lt;a class=&quot;kLink&quot; href=&quot;http://www.functionx.com/sqlserver/Lesson35.htm#&quot; id=&quot;KonaLink8&quot; style=&quot;background-attachment: initial !important; background-clip: initial !important; background-color: transparent !important; background-image: none !important; background-origin: initial !important; border-bottom-color: transparent !important; border-bottom-style: none !important; border-bottom-width: 0px !important; border-image: initial !important; border-left-color: transparent !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: transparent !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: transparent !important; border-top-style: none !important; border-top-width: 0px !important; bottom: 0px; color: blue; cursor: pointer; display: inline !important; font-family: inherit !important; font-size: inherit !important; left: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; outline-color: initial; outline-style: none; outline-width: initial; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: static; right: 0px; top: 0px;&quot;&gt;&lt;span style=&quot;color: blue; font-family: inherit !important; font-size: inherit !important; position: static;&quot;&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;SQL&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kLink&quot; style=&quot;background-attachment: initial; background-clip: initial; background-color: transparent; background-image: none; background-origin: initial; border-bottom-color: initial; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: initial !important; border-left-style: none !important; border-left-width: 0px !important; border-right-color: initial !important; border-right-style: none !important; border-right-width: 0px !important; border-top-color: initial !important; border-top-style: none !important; border-top-width: 0px !important; display: inline !important; float: none !important; font-family: inherit !important; font-size: inherit !important; padding-bottom: 1px !important; padding-left: 0px !important; padding-right: 0px !important; padding-top: 0px !important; position: static; width: auto !important;&quot;&gt;statement&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;to update the stored procedure.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
In Transact-SQL, the basic formula to modify a stored procedure is:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;ALTER PROCEDURE [&lt;em&gt;SchemaName&lt;/em&gt;.]&lt;i&gt;ProcedureName&lt;/i&gt;
AS
&lt;i&gt;Body of Procedure&lt;/i&gt;&lt;/pre&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;AlterProc1&quot;&gt;&lt;/a&gt;Recompiling a Stored Procedure&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
When you create a stored procedure, it considers the state of the database at that time. This includes the columns and records in the tables, the primary keys, the foreign keys, etc. It is not unusual for a user of the database to change any of these details. After such operations have occurred, the stored procedure may not be updated and may show previous details before the changes. One way you can take care of the stored procedure is to ask the database engine to recompile the stored procedure.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
To ask the database engine to check the stored procedure and recompile it the next time it is executed, when creating the procedure, before the&amp;nbsp;&lt;b&gt;AS&lt;/b&gt;&amp;nbsp;keyword, add a&amp;nbsp;&lt;strong&gt;WITH RECOMPILE&lt;/strong&gt;&amp;nbsp;expression. The formula to follow is:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROC/PROCEDURE [&lt;em&gt;SchemaName&lt;/em&gt;.]&lt;i&gt;ProcedureName&lt;/i&gt;
AS
&lt;span style=&quot;color: red;&quot;&gt;WITH RECOMPILE&lt;/span&gt;
&lt;i&gt;Body of the Procedure&lt;/i&gt;&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Here is an example:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROCEDURE Registration.GetStudentsByGender
&lt;span class=&quot;codered&quot; style=&quot;color: red; font-size: 10pt;&quot;&gt;WITH RECOMPILE&lt;/span&gt;
AS
    SET NOCOUNT ON
    SELECT FirstName, LastName, DateOfBirth, Gender
    FROM   Students
GO&lt;/pre&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
Deleting a Stored Procedure&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
One of the characteristics of a stored procedure is that it is treated like an object in its own right. Therefore, after creating it, if you don&#39;t need it anymore, you can get rid of it.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
There are various types of stored procedures, some of which are considered temporary. Those types of procedures delete themselves when not needed anymore, such as when the person who created the stored procedure disconnects from the database or shuts down the computer. Otherwise, to delete a stored procedure, you can use either the Object Explorer or SQL. As mentioned with tables, even if you create a stored procedure using the Object Explorer, you can delete it using SQL and vice-versa.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
To delete a stored procedure in the Object Explorer, after expanding its database, its Programmability, and its Stored Procedure nodes, right-click the stored procedure and click Delete. You can also click it in the Object Explorer to select it and then press Delete. The Delete Object dialog box would come up to let you make a decision.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
&lt;a href=&quot;&quot; name=&quot;DropProc&quot;&gt;&lt;/a&gt;To delete a stored procedure in SQL, the syntax to use is:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;DROP PROCEDURE [&lt;em&gt;SchemaName&lt;/em&gt;.]&lt;i&gt;ProcedureName&lt;/i&gt;&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Of course, you should make sure you are in the right database and also that the&amp;nbsp;&lt;i&gt;ProcedureName&lt;/i&gt;&amp;nbsp;exists.&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
Using Expressions and Functions&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
One of the advantages of using a stored procedure is that not only can it produce the same expression as we saw for data selection but also it can store such an expression to be recalled any time without having to re-write it (the expression). Based on this, you can create an expression that combines a first and a last name to produce and store a full name. Here is an example:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROCEDURE Registration.GetStudentIdentification
AS
BEGIN
    SET NOCOUNT ON
    SELECT FullName = FirstName + N&#39; &#39; + LastName,
           DateOfBirth, Gender
    FROM Registration.Students
END
GO&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
A stored procedure can also call a function in its body. To do this, follow the same rules we reviewed for&lt;a href=&quot;http://www.functionx.com/sqlserver/Lesson20.htm#Functions&quot; style=&quot;color: green; font-size: 10pt; font-weight: bold; text-decoration: none;&quot;&gt;calling functions during data selection&lt;/a&gt;. Here is an example of a stored procedure that calls a function:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROCEDURE Registration.GetStudentsAges
AS
BEGIN
    SET NOCOUNT ON
    SELECT FullName = FirstName + N&#39; &#39; + LastName,
           &lt;span style=&quot;color: red;&quot;&gt;DATEDIFF(year, DateOfBirth, GETDATE())&lt;/span&gt; AS Age,
           Gender
    FROM Registration.Students
END
GO&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Here is an example of executing the stored procedure:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;EXEC rosh.Registration.GetStudentsAges;
GO&lt;/pre&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Stored Procedure&quot; border=&quot;0&quot; height=&quot;528&quot; src=&quot;http://www.functionx.com/sqlserver/queries/procedure2.gif&quot; width=&quot;515&quot; /&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;paratitle&quot; style=&quot;color: red; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 16pt; font-weight: bold;&quot;&gt;
Arguments and Parameters&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#FF0000&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&amp;nbsp;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
Introduction&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
All of the stored procedures we have created and used so far assumed that the values they needed were already in a table of the database. In some cases, you may need to create a stored procedure that involves values that are not part of the database. On such a scenario, for the stored procedure to carry its assignment, you would supply it with one or more values.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
An external value that is provided to a stored procedure is called a parameter. When you create a stored procedure, you must also create the parameter if you judge it necessary. When a procedure&#39;s creation is equipped with a parameter, it is said that the stored procedure takes an argument. A stored procedure can also take more than one argument.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
When you execute a stored procedure that takes one or more arguments, you must provide a value for each argument. In this case, you are said to pass a value for the argument. There are cases when you don&#39;t have to provide an argument.&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
Passing Arguments&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
To create a stored procedure that takes an argument, type the formula&amp;nbsp;&lt;b&gt;CREATE PROCEDURE&lt;/b&gt;&amp;nbsp;or&lt;b&gt;CREATE PROC&lt;/b&gt;&amp;nbsp;followed by the name of the procedure, then type the name of the argument starting with @. The parameter is created like a column of a table. That is, a parameter must have a name, a data type and an optional length. Here is the syntax you would use:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROC/PROCEDURE [&lt;em&gt;SchemaName&lt;/em&gt;.]&lt;i&gt;ProcedureName&lt;/i&gt;
&lt;b&gt;@&lt;/b&gt;&lt;i&gt;ParameterName DataType&lt;/i&gt;
AS
&lt;i&gt;Body of the Procedure&lt;/i&gt;&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
When implementing the stored procedure, in the body of the procedure, you can define what you want to do with the parameter(s). One way you can use a parameter is to run a query whose statement the user would provide. For example, imagine you want to create a stored procedure that, whenever executed, would be supplied with a gender, then it would display the list of students of that gender. Since you want the user to specify the gender of students to display, you can create a stored procedure that receives the gender. Here is an example:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROCEDURE Registration.GetListOfStudentsByGender
       @Gdr NVARCHAR(12)
AS
    SELECT FirstName, LastName,
           DateOfBirth, HomePhone, Gender
    FROM   Students
    WHERE  Gender = @Gdr&lt;/pre&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Stored Procedure&quot; height=&quot;271&quot; src=&quot;http://www.functionx.com/sqlserver/queries/sp3.gif&quot; width=&quot;514&quot; /&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;exotitle&quot; style=&quot;color: #cc3300; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
&lt;img alt=&quot;Practical Learning&quot; border=&quot;0&quot; height=&quot;18&quot; src=&quot;http://www.functionx.com/images/practical1.gif&quot; width=&quot;19&quot; /&gt;Practical Learning: Creating a Stored Procedure&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#CC3300&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;ol&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To pass arguments to a stored procedure, type the following in the window:&lt;br /&gt;&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt;&quot;&gt;USE WattsALoan1;
GO

CREATE PROCEDURE Loans.SpecifyCurrentBalance
    @PmtDate date,
    @EmplID int,
    @LaID int,
    @PmtAmt money
AS
BEGIN
    -- Get the amount that was lent to the customer
    DECLARE @AmountOfLoan money;
    SET @AmountOfLoan = (SELECT las.FutureValue
                         FROM Loans.Allocations las
                         WHERE (las.AllocationID = @LaID));

    -- If the customer had already made at least one payment,
    -- get the current balance of the customer&#39;s account
    DECLARE @CurrentBalance money;
    SET     @CurrentBalance = (SELECT MIN(pay.Balance)
                               FROM Loans.Payments pay
                               WHERE (pay.AllocationID = @LaID));

    -- If the customer has never made a payment (yet),
    -- to specify the balance, subtract the current payment
    -- from the original amount of the loan
    IF      @CurrentBalance IS NULL
 BEGIN
     INSERT INTO Loans.Payments(PaymentDate, EmployeeID,
     AllocationID, PaymentAmount, Balance)
     VALUES(@PmtDate, @EmplID, @LaID, @PmtAmt,
     @AmountOfLoan - @PmtAmt);
 END
    -- If the customer had already at least one payment,
    -- subtract the current payment from the previous balance
    ELSE
 BEGIN
     INSERT INTO Loans.Payments(PaymentDate, EmployeeID,
           AllocationID, PaymentAmount, Balance)
     VALUES(@PmtDate, @EmplID, @LaID,
     @PmtAmt, @CurrentBalance - @PmtAmt);
 END
END
GO&lt;/pre&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To create the stored procedure, on the main, click Query -&amp;gt; Execute&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Click inside the top section of the Query window and press Ctrl + A&lt;/li&gt;
&lt;/ol&gt;
&lt;/span&gt;&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot;&gt;&lt;table border=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td align=&quot;center&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;ins style=&quot;border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; display: inline-table; height: 250px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: relative; visibility: visible; width: 300px;&quot;&gt;&lt;ins id=&quot;aswift_1_anchor&quot; style=&quot;border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; display: block; height: 250px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: relative; visibility: visible; width: 300px;&quot;&gt;&lt;iframe allowtransparency=&quot;true&quot; frameborder=&quot;0&quot; height=&quot;250&quot; hspace=&quot;0&quot; id=&quot;aswift_1&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; name=&quot;aswift_1&quot; scrolling=&quot;no&quot; style=&quot;left: 0px; position: absolute; top: 0px;&quot; vspace=&quot;0&quot; width=&quot;300&quot;&gt;&lt;/iframe&gt;&lt;/ins&gt;&lt;/ins&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td align=&quot;center&quot; style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;&lt;table border=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td align=&quot;center&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;ins style=&quot;border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; display: inline-table; height: 600px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: relative; visibility: visible; width: 160px;&quot;&gt;&lt;ins id=&quot;aswift_2_anchor&quot; style=&quot;border-bottom-style: none; border-color: initial; border-image: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; display: block; height: 600px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; position: relative; visibility: visible; width: 160px;&quot;&gt;&lt;iframe allowtransparency=&quot;true&quot; frameborder=&quot;0&quot; height=&quot;600&quot; hspace=&quot;0&quot; id=&quot;aswift_2&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; name=&quot;aswift_2&quot; scrolling=&quot;no&quot; style=&quot;left: 0px; position: absolute; top: 0px;&quot; vspace=&quot;0&quot; width=&quot;160&quot;&gt;&lt;/iframe&gt;&lt;/ins&gt;&lt;/ins&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;table border=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td align=&quot;center&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&amp;nbsp;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/center&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13px; text-align: -webkit-auto;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;div align=&quot;center&quot; style=&quot;font-family: Verdana, Helvetica, Arial, sans-serif; font-size: 13px;&quot;&gt;
&lt;center&gt;&lt;table border=&quot;0&quot; style=&quot;width: 900px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td rowspan=&quot;2&quot; style=&quot;font-size: 10pt;&quot; width=&quot;680&quot;&gt;&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
Executing an Argumentative Stored Procedure&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
As mentioned already, when executing a stored procedure that takes a parameter, make sure you provide a value for the parameter. The syntax used is:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;EXEC/EXECUTE [&lt;em&gt;SchemaName&lt;/em&gt;.]&lt;i&gt;ProcedureName&lt;/i&gt; &lt;i&gt;ParameterValue&lt;/i&gt;&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
If the parameter is Boolean or numeric, make sure you provide the value as 0 or for a Boolean value or another number for the numeric type. If the parameter is a character or a string, type its value in single-quotes. Here is an example:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;EXEC rosh.Registration.GetListOfStudentsByGender N&#39;Male&#39;;&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Here is an example of executing it:&lt;/div&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Procedure&quot; border=&quot;0&quot; height=&quot;494&quot; src=&quot;http://www.functionx.com/sqlserver/queries/procedure1.gif&quot; width=&quot;514&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Notice that we could/should have omitted the Gender column in the statement since it would be implied.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Another type of stored procedure can be made to take more than one parameter. In this case, create the parameters in the section before the&amp;nbsp;&lt;b&gt;AS&lt;/b&gt;&amp;nbsp;keyword, separated by (a) comma(s). The syntax you would use is:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROC/PROCEDURE [&lt;em&gt;SchemaName&lt;/em&gt;.]&lt;i&gt;ProcedureName&lt;/i&gt;
&lt;b&gt;@&lt;/b&gt;&lt;i&gt;ParameterName1 DataType, &lt;/i&gt;&lt;b&gt;@&lt;/b&gt;&lt;i&gt;ParameterName2 DataType, &lt;/i&gt;&lt;b&gt;@&lt;/b&gt;&lt;i&gt;ParameterName_n DataType&lt;/i&gt;
AS
&lt;i&gt;Body of the Procedure&lt;/i&gt;&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Here is an example:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;USE ROSH;
GO
CREATE PROCEDURE Registration.IdentifyStudentsByState
 &lt;span style=&quot;color: red;&quot;&gt;@Gdr nvarchar(20),
 @StateOrProvince char(2)&lt;/span&gt;
AS
BEGIN
    SELECT FullName = LastName + &#39;, N&#39; + FirstName,
           DATEDIFF(year, DateOfBirth, GETDATE()) AS Age,
           Gender
    FROM Registration.Students
    WHERE (Gender = @Gdr) AND (State = @StateOrProvince);
END
GO&lt;/pre&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Stored Procedure&quot; height=&quot;382&quot; src=&quot;http://www.functionx.com/sqlserver/queries/sp4.gif&quot; width=&quot;546&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
When calling a stored procedure that takes more than one parameter, you must still provide a value for each parameter but you have two alternatives. The simplest technique consists of providing a value for each parameter in the exact order they appear in the stored procedure. Here is an example:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;USE ROSH;
GO
EXEC rosh.Registration.IdentifyStudentsByState &lt;span style=&quot;color: red;&quot;&gt;N&#39;Female&#39;, N&#39;MD&#39;&lt;/span&gt;;
GO&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
This would produce:&lt;/div&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Procedure&quot; border=&quot;0&quot; height=&quot;492&quot; src=&quot;http://www.functionx.com/sqlserver/queries/procedure3.gif&quot; width=&quot;563&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Alternatively, you can provide the value for each parameter in the order of your choice. Consider the following stored procedure that takes 3 arguments:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;USE ROSH;
GO
CREATE PROCEDURE Registration.IdentifySomeStudents
 &lt;span style=&quot;color: red;&quot;&gt;@Gdr nvarchar(20),
 @StateOrProvince nchar(2),
 @HomeStatus bit&lt;/span&gt;
AS
BEGIN
    SET NOCOUNT ON
    SELECT FullName = LastName + N&#39;, &#39; + FirstName,
           DATEDIFF(year, DateOfBirth, GETDATE()) AS Age,
           Gender
    FROM Registration.Students
    WHERE (Gender = @Gdr) AND 
          (State  = @StateOrProvince) AND
          (SingleParentHome = @HomeStatus);
END
GO&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
When calling this type of procedure, you can type the name of each parameter and assign it the corresponding value. Here is an example:&lt;/div&gt;
&lt;pre class=&quot;sectover&quot; style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; overflow-x: scroll; overflow-y: scroll; text-align: left; width: 660px;&quot;&gt;USE ROSH;
GO
EXEC Registration.IdentifySomeStudents &lt;span style=&quot;color: red;&quot;&gt;@HomeStatus=1, @StateOrProvince=N&#39;MD&#39;, @Gdr=N&#39;Female&#39;&lt;/span&gt;;
GO&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Here is an example of executing the procedure:&lt;/div&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Stored Procedure&quot; border=&quot;0&quot; height=&quot;382&quot; src=&quot;http://www.functionx.com/sqlserver/queries/procedure4.gif&quot; width=&quot;568&quot; /&gt;&lt;/div&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;exotitle&quot; style=&quot;color: #cc3300; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
&lt;img alt=&quot;Practical Learning&quot; border=&quot;0&quot; height=&quot;18&quot; src=&quot;http://www.functionx.com/images/practical1.gif&quot; width=&quot;19&quot; /&gt;Practical Learning: Executing an Argumentative Procedure&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#CC3300&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;ol&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To execute the stored procedure, type the following:&lt;br /&gt;&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt;&quot;&gt;USE WattsALoan1;
GO
EXECUTE Loans.SpecifyCurrentBalance N&#39;03/25/2004&#39;, 2, 1, 249.08;
GO
EXECUTE Loans.SpecifyCurrentBalance N&#39;01/30/2006&#39;, 2, 5, 611.93;
GO
EXECUTE Loans.SpecifyCurrentBalance N&#39;04/20/2004&#39;, 1, 1, 249.08;
GO
EXECUTE Loans.SpecifyCurrentBalance N&#39;10/28/2006&#39;, 2, 4, 134.38;
GO&lt;/pre&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To execute, press F5&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To see a list of payments made on different loans, type the following:&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt;&quot;&gt;SELECT ALL * FROM Loans.Payments;
GO&lt;/pre&gt;
&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;To see the result, on the main menu, click Query -&amp;gt; Execute&lt;/li&gt;
&lt;li style=&quot;font-size: 10pt; margin-bottom: 6pt; margin-top: 6pt; text-align: left;&quot;&gt;Click inside the top section of the Query window and press Ctrl + A&lt;/li&gt;
&lt;/ol&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;div class=&quot;subtitle&quot; style=&quot;color: blue; font-family: Georgia, &#39;Times New Roman&#39;, &#39;Courier New&#39;; font-size: 14pt; font-weight: bold;&quot;&gt;
Default Arguments&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td bgcolor=&quot;#0000FF&quot; height=&quot;1&quot; style=&quot;font-size: 10pt;&quot; width=&quot;100%&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Imagine you create a database for a department store and a table that holds the list of items sold in the store:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE TABLE Inventory.Categories
(
    CategoryID int identity(1, 1) primary key,
    Category nvarchar(20) not null
);
GO
INSERT INTO Inventory.Categories(Category)
VALUES(N&#39;Men&#39;), (N&#39;Women&#39;), (N&#39;Boys&#39;), (N&#39;Girls&#39;),(N&#39;Miscellaneous&#39;);
GO
CREATE TABLE Inventory.StoreItems
(
    ItemNumber nvarchar(10) primary key,
    CategoryID int foreign key
        references Inventory.Categories(CategoryID),
    ItemName nvarchar(60) not null,
    Size nvarchar(20),
    UnitPrice money
);
INSERT INTO Inventory.StoreItems
VALUES(N&#39;264850&#39;, 2, N&#39;Long-Sleeve Jersey Dress&#39;, N&#39;Petite&#39;, 39.95),
      (N&#39;930405&#39;, 4, N&#39;Solid Crewneck Tee&#39;, N&#39;Medium&#39;, 12.95),
      (N&#39;293004&#39;, 1, N&#39;Cotton Comfort Open Bottom Pant&#39;, N&#39;XLarge&#39;, 17.85),
      (N&#39;924515&#39;, 1, N&#39;Hooded Full-Zip Sweatshirt&#39;, N&#39;S&#39;, 69.95),
      (N&#39;405945&#39;, 3, N&#39;Plaid Pinpoint Dress Shirt&#39;, N&#39;22 35-36&#39;, 35.85),
      (N&#39;294936&#39;, 2, N&#39;Cool-Dry Soft Cup Bra&#39;, N&#39;36D&#39;, 15.55),
      (N&#39;294545&#39;, 2, N&#39;Ladies Hooded Sweatshirt&#39;, N&#39;Medium&#39;, 45.75),
      (N&#39;820465&#39;, 2, N&#39;Cotton Knit Blazer&#39;, N&#39;M&#39;, 295.95),
      (N&#39;294694&#39;, 2, N&#39;Denim Blazer - Natural Brown&#39;, N&#39;Large&#39;, 75.85),
      (N&#39;924094&#39;, 3, N&#39;Texture-Striped Pleated Dress Pants&#39;, N&#39;44x30&#39;, 32.85),
      (N&#39;359405&#39;, 3, N&#39;Iron-Free Pleated Khaki Pants&#39;, N&#39;32x32&#39;, 39.95),
      (N&#39;192004&#39;, 3, N&#39;Sunglasses&#39;, NULL, 15.85);
GO&lt;/pre&gt;
&lt;div align=&quot;center&quot;&gt;
&lt;center&gt;&lt;table border=&quot;1&quot; bordercolor=&quot;#C0C0C0&quot; style=&quot;width: 621px;&quot;&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;&lt;b&gt;ItemNumber&lt;/b&gt;&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;&lt;b&gt;ItemCategoryID&lt;/b&gt;&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;&lt;b&gt;ItemName&lt;/b&gt;&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;&lt;b&gt;ItemSize&lt;/b&gt;&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;&lt;b&gt;UnitPrice&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;264850&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;Long-Sleeve Jersey Dress&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;Petite&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;39.95&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;930405&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;4&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;Solid Crewneck Tee&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;Medium&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;12.95&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;293004&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;Cotton Comfort Open Bottom Pant&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;XLarge&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;17.85&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;924515&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;1&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;Hooded Full-Zip Sweatshirt&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;S&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;69.95&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;405945&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;3&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;Plaid Pinpoint Dress Shirt&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;22 35-36&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;35.85&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;294936&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;Cool-Dry Soft Cup Bra&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;36D&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;15.55&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;294545&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;Ladies Hooded Sweatshirt&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;Medium&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;45.75&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;820465&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;Cotton Knit Blazer&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;M&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;295.95&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;294694&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;2&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;Denim Blazer - Natural Brown&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;Large&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;75.85&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;924094&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;3&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;Texture-Striped Pleated Dress Pants&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;44x30&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;32.85&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;359405&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;3&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;Iron-Free Pleated Khaki Pants&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;32x32&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;39.95&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;92&quot;&gt;192004&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;118&quot;&gt;3&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;247&quot;&gt;Sunglasses&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;67&quot;&gt;&amp;nbsp;&lt;/td&gt;&lt;td style=&quot;font-size: 10pt;&quot; width=&quot;65&quot;&gt;15.85&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/center&gt;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Imagine you want to create a mechanism of calculating the price of an item after a discount has been applied to it. Such a procedure can be created as follows:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROCEDURE Inventory. CalculateNetPrice
@discount Decimal
AS
    SET NOCOUNT ON
    SELECT ItemName, UnitPrice - (UnitPrice * @discount / 100)
    FROM StoreItems;
GO&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
This can be executed as follows:&lt;/div&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Stored Procedure&quot; border=&quot;0&quot; height=&quot;384&quot; src=&quot;http://www.functionx.com/sqlserver/queries/default3a.gif&quot; width=&quot;466&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
If you are planning to create a stored procedure that takes an argument and know that the argument will likely have the same value most of the time, you can provide that value as parameter but leave a room for other values of that argument. A value given to an argument is referred to as default. What this implies is that, when the user calls that stored procedure, if the user doesn&#39;t provide a value for the argument, the default value would be used.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
To create a stored procedure that takes an argument that carries a default value, after declaring the value, on its right side, type = followed by the desired value. Here is an example applied to the above database:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROCEDURE Inventory.CalculateDiscountedPrice
@discount decimal &lt;span style=&quot;color: red;&quot;&gt;= 10.00&lt;/span&gt;
AS
    SET NOCOUNT ON
    SELECT ItemName, UnitPrice - (UnitPrice * @discount / 100)
    FROM StoreItems;
GO&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
When executing a stored procedure that takes a default argument, you don&#39;t have to provide a value for the argument if the default value suits you. Based on this, the above stored procedure can be called as follows:&lt;/div&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Stored Procedure&quot; border=&quot;0&quot; height=&quot;383&quot; src=&quot;http://www.functionx.com/sqlserver/queries/default3b.gif&quot; width=&quot;465&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
If the default value doesn&#39;t apply to your current calculation, you can provide a value for the argument. Here is an example:&lt;/div&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Stored Procedure&quot; border=&quot;0&quot; height=&quot;384&quot; src=&quot;http://www.functionx.com/sqlserver/queries/default3c.gif&quot; width=&quot;467&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
On the other hand, you can ask the database engine to get the default value. To do this, pass the argument as&amp;nbsp;&lt;b&gt;DEFAULT&lt;/b&gt;. Here is an example:&lt;/div&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Stored Procedure&quot; border=&quot;0&quot; height=&quot;384&quot; src=&quot;http://www.functionx.com/sqlserver/queries/procedure7b.gif&quot; width=&quot;467&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
You can create a stored procedure that takes more than one argument with default values. To provide a default value for each argument, after declaring it, type the desired value to its right side. Here is an example of a stored procedure that takes two arguments, each with a default value:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;CREATE PROCEDURE Inventory.CalculateSalePrice
@Discount decimal = 20.00,
@TaxRate  decimal = 7.75
AS
    SET NOCOUNT ON
    SELECT ItemName As [Item Description],
           UnitPrice As [Marked Price],
           UnitPrice * @Discount / 100 As [Discount Amt],
           UnitPrice - (UnitPrice * @Discount / 100) As [After Discount],
           UnitPrice * @TaxRate / 100 As [Tax Amount],
           (UnitPrice * @TaxRate / 100) + UnitPrice - 
           (UnitPrice * @Discount / 100) + (@TaxRate / 100) As [Net Price]
FROM StoreItems;
GO&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
Here is an example of executing the procedure:&lt;/div&gt;
&lt;div class=&quot;pcenter&quot; style=&quot;text-align: center;&quot;&gt;
&lt;img alt=&quot;Stored Procedure&quot; border=&quot;0&quot; height=&quot;386&quot; src=&quot;http://www.functionx.com/sqlserver/queries/default3e.gif&quot; width=&quot;605&quot; /&gt;&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
When calling a stored procedure that takes more than one argument and all arguments have default values, you don&#39;t need to provide a value for each argument, you can provide a value for only one or some of the arguments. The above procedure can be called with one argument as follows:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;EXEC CalculateSalePrice 55.00&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
In this case, the other argument(s) would use their default value.&lt;/div&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
We saw that, when calling a stored procedure that takes more than one argument, you didn&#39;t have to provide the values of the arguments in the exact order they appeared in the procedure, you just had to type the name of each argument and assign it the desired value. In the same way, if a stored procedure takes more than one argument and some of the arguments have default values, when calling it, you can provide the values in the order of your choice, by typing the name of each argument and assigning it the desired value. Based on this, the above stored procedure can be called with only the value of the second argument as follows:&lt;/div&gt;
&lt;pre style=&quot;color: blue; font-family: &#39;Courier New&#39;, Verdana, Helvetica, sans-serif; font-size: 10pt; text-align: left;&quot;&gt;EXEC CalculateSalePrice @TaxRate = 8.55&lt;/pre&gt;
&lt;div class=&quot;parajust&quot; style=&quot;font-size: 10pt; margin-bottom: 10pt; margin-left: 10pt; margin-top: 8pt; text-align: justify;&quot;&gt;
In this case, the first argument would use its default value.&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/center&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/1910208721325254431/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2012/06/how-to-create-stored-procedures-or-what.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/1910208721325254431'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/1910208721325254431'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2012/06/how-to-create-stored-procedures-or-what.html' title='How to Create Stored Procedures or What is Stored Procedures in sql server'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-3624166944736133911</id><published>2012-06-29T13:02:00.003-07:00</published><updated>2012-06-29T13:02:42.981-07:00</updated><title type='text'>How to Create Database and tables  in Sql server effictivly</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;a href=&quot;http://www.youtube.com/watch?v=3WpBeYvy1V0&quot;&gt;Create Database and Tables&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/3624166944736133911/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2012/06/how-to-create-database-and-tables-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/3624166944736133911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/3624166944736133911'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2012/06/how-to-create-database-and-tables-in.html' title='How to Create Database and tables  in Sql server effictivly'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-6404261873425353093</id><published>2012-06-29T12:46:00.001-07:00</published><updated>2012-06-29T12:46:20.858-07:00</updated><title type='text'>Store and Fetch Images From Database Using Asp.net</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
This article is to designed to show how to store and fetch image from SQL Server Database Using Asp.net&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH5w8H3F8SKVMmPr0I93FgSlpBTxijuzVB6D4QPS40cFufyXdx_D4hejDAR5mSiU9lPTdSov6j6PDZSriYm_yXxfdkaJdwaLhUDvd-UsDb4B8S1jxqShWDNgHOpJvYChP3bjyYJtxr4EQ/s1600/Demo.JPG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;221&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH5w8H3F8SKVMmPr0I93FgSlpBTxijuzVB6D4QPS40cFufyXdx_D4hejDAR5mSiU9lPTdSov6j6PDZSriYm_yXxfdkaJdwaLhUDvd-UsDb4B8S1jxqShWDNgHOpJvYChP3bjyYJtxr4EQ/s320/Demo.JPG&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
Step 1. Create Database&lt;br /&gt;
&lt;br /&gt;
CREATE DATABASE [Employee]&lt;br /&gt;
GO&lt;br /&gt;
USE [Employee]&lt;br /&gt;
GO&lt;br /&gt;
CREATE TABLE EmpDetails&lt;br /&gt;
(&lt;br /&gt;
empid int IDENTITY NOT NULL,&lt;br /&gt;
empname varchar(20),&lt;br /&gt;
empimg image&lt;br /&gt;
)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
** name of the database can be anything or the structure of the table can be altered. But the image field should have the datatype of Image.&lt;br /&gt;
&lt;br /&gt;
------------------------------------------------------------------------------------------------------------&lt;br /&gt;
Step 2. Create a new Website and the source code for the page is given below&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&amp;gt;&lt;br /&gt;
&amp;lt;head id=&quot;Head1&quot; runat=&quot;server&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Save Retrieve Images&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Label ID=&quot;lblEmpName&quot; runat=&quot;server&quot; Text=&quot;Employee Name&quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:TextBox ID=&quot;txtEName&quot; runat=&quot;server&quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Label ID=&quot;lblImage&quot; runat=&quot;server&quot; Text=&quot;Employee Image&quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;
&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:FileUpload ID=&quot;imgUpload&quot; runat=&quot;server&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Button ID=&quot;btnSubmit&quot; runat=&quot;server&quot; onclick=&quot;btnSubmit_Click&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Text=&quot;Submit&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;asp:Label ID=&quot;lblResult&quot; runat=&quot;server&quot; ForeColor=&quot;#0066FF&quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;hr /&amp;gt;&lt;br /&gt;
&amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;lt;asp:Image ID=&quot;Image1&quot; style=&quot;width:200px&quot; Runat=&quot;server&quot; /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
** controls can be altered as per user requirement&lt;br /&gt;
------------------------------------------------------------------------------------------------------&lt;br /&gt;
Step 3. Code for C# part&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Configuration;&lt;br /&gt;
using System.Web;&lt;br /&gt;
using System.Web.Security;&lt;br /&gt;
using System.Web.UI;&lt;br /&gt;
using System.Web.UI.WebControls;&lt;br /&gt;
using System.Web.UI.WebControls.WebParts;&lt;br /&gt;
using System.Web.UI.HtmlControls;&lt;br /&gt;
using System.Data.SqlClient;&lt;br /&gt;
public partial class _Default : System.Web.UI.Page&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected void btnSubmit_Click(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlConnection connection = null;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FileUpload img = (FileUpload)imgUpload;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Byte[] imgByte = null;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (img.HasFile &amp;amp;&amp;amp; img.PostedFile != null)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //To create a PostedFile&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HttpPostedFile File = imgUpload.PostedFile;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Create byte Array with file len&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; imgByte = new Byte[File.ContentLength];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //force the control to load data in array&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; File.InputStream.Read(imgByte, 0, File.ContentLength);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Insert the employee name and image into db&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //string conn = ConfigurationManager.ConnectionStrings[&quot;EmployeeConnString&quot;].ConnectionString;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; connection = new SqlConnection(&quot;server=YASH;database=Employee;Trusted_connection=true&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; connection.Open();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string sql = &quot;INSERT INTO EmpDetails(empname,empimg) VALUES(@enm, @eimg) SELECT @@IDENTITY&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand(sql, connection);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.AddWithValue(&quot;@enm&quot;, txtEName.Text.Trim());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.AddWithValue(&quot;@eimg&quot;, imgByte);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int id = Convert.ToInt32(cmd.ExecuteScalar());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lblResult.Text = String.Format(&quot;Employee ID is {0}&quot;, id);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Image1.ImageUrl = &quot;~/ShowImage.ashx?id=&quot; + id;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lblResult.Text = &quot;There was an error&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; finally&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; connection.Close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;div&gt;
** of course you have to change the name of the project and name of sql server in my case it is yash&lt;/div&gt;
&lt;div&gt;
---------------------------------------------------------------------------------------------------------&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Step 4. &amp;nbsp;upto the Step 3 everything was done to store the image now for fetching the image you have to add Generic Handler in the project&lt;/div&gt;
&lt;div&gt;
right click on project&amp;gt;&amp;gt; add new item&amp;gt;&amp;gt; Generic handler&lt;/div&gt;
&lt;div&gt;
i have named it Showimage you can name it anything as you want&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Code for the Handler&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&amp;lt;%@ WebHandler Language=&quot;C#&quot; Class=&quot;ShowImage&quot; %&amp;gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
using System;&lt;/div&gt;
&lt;div&gt;
using System.Configuration;&lt;/div&gt;
&lt;div&gt;
using System.Web;&lt;/div&gt;
&lt;div&gt;
using System.IO;&lt;/div&gt;
&lt;div&gt;
using System.Data;&lt;/div&gt;
&lt;div&gt;
using System.Data.SqlClient;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
public class ShowImage : IHttpHandler&lt;/div&gt;
&lt;div&gt;
{&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; public void ProcessRequest(HttpContext context)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Int32 empno;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (context.Request.QueryString[&quot;id&quot;] != null)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; empno = Convert.ToInt32(context.Request.QueryString[&quot;id&quot;]);&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw new ArgumentException(&quot;No parameter specified&quot;);&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context.Response.ContentType = &quot;image/jpeg&quot;;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Stream strm = ShowEmpImage(empno);&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; byte[] buffer = new byte[4096];&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int byteSeq = strm.Read(buffer, 0, 4096);&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while (byteSeq &amp;gt; 0)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context.Response.OutputStream.Write(buffer, 0, byteSeq);&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; byteSeq = strm.Read(buffer, 0, 4096);&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;context.Response.BinaryWrite(buffer);&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; public Stream ShowEmpImage(int empno)&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //string conn = ConfigurationManager.ConnectionStrings[&quot;EmployeeConnString&quot;].ConnectionString;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlConnection connection = new SqlConnection(&quot;server=YASH;database=Employee;Trusted_connection=true&quot;);&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string sql = &quot;SELECT empimg FROM EmpDetails WHERE empid = @ID&quot;;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand(sql, connection);&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.CommandType = CommandType.Text;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.AddWithValue(&quot;@ID&quot;, empno);&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; connection.Open();&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; object img = cmd.ExecuteScalar();&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return new MemoryStream((byte[])img);&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return null;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; finally&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; connection.Close();&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; public bool IsReusable&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; get&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return false;&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
}&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
** You have to change the name of sql server it was &quot;yash&quot; in my case&lt;/div&gt;
&lt;div&gt;
-----------------------------------------------------------------------------&lt;/div&gt;
&lt;div&gt;
Step 5: F5&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/6404261873425353093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2012/06/store-and-fetch-images-from-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/6404261873425353093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/6404261873425353093'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2012/06/store-and-fetch-images-from-database.html' title='Store and Fetch Images From Database Using Asp.net'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiH5w8H3F8SKVMmPr0I93FgSlpBTxijuzVB6D4QPS40cFufyXdx_D4hejDAR5mSiU9lPTdSov6j6PDZSriYm_yXxfdkaJdwaLhUDvd-UsDb4B8S1jxqShWDNgHOpJvYChP3bjyYJtxr4EQ/s72-c/Demo.JPG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-8260446530639830579</id><published>2011-09-08T00:35:00.000-07:00</published><updated>2013-08-15T13:03:55.346-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Add counter to your website for free"/><title type='text'>how to add counter to user website using http://www.1freecounter.com</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
first go to the website and create code for your website after creating the account of 1freecounter.com and its very its.... then it asks for some data from u...&lt;br /&gt;
&lt;br /&gt;
then its produces code for ur website for your website&lt;br /&gt;
&lt;br /&gt;
such example of such code is give below&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;lt;!-- Start 1FreeCounter.com code --&amp;gt;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;lt;script language=&quot;JavaScript&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; var data = &#39;&amp;amp;r=&#39; + escape(document.referrer)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;+ &#39;&amp;amp;n=&#39; + escape(navigator.userAgent)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;+ &#39;&amp;amp;p=&#39; + escape(navigator.userAgent)&lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;+ &#39;&amp;amp;g=&#39; + escape(document.location.href);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; if (navigator.userAgent.substring(0,1)&amp;gt;&#39;3&#39;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; data = data + &#39;&amp;amp;sd=&#39; + screen.colorDepth &lt;br /&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp;+ &#39;&amp;amp;sw=&#39; + escape(screen.width+&#39;x&#39;+screen.height);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; document.write(&#39;&amp;lt;a href=&quot;http://www.1freecounter.com/stats.php?i=82908&quot; target=\&quot;_blank\&quot; &amp;gt;&#39;);&lt;br /&gt;
&amp;nbsp; document.write(&#39;&amp;lt;img alt=&quot;Free Counter&quot; border=0 hspace=0 &#39;+&#39;vspace=0 src=&quot;http://www.1freecounter.com/counter.php?i=82908&#39; + data + &#39;&quot;&amp;gt;&#39;);&lt;br /&gt;
&amp;nbsp; document.write(&#39;&amp;lt;/a&amp;gt;&#39;);&lt;br /&gt;
&amp;nbsp; &amp;lt;/script&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- End 1FreeCounter.com code --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
then u have to copy this code to your website and&amp;nbsp; counter ticks on wid each user comes on the website &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/8260446530639830579/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/09/how-to-add-counter-to-user-website.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/8260446530639830579'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/8260446530639830579'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/09/how-to-add-counter-to-user-website.html' title='how to add counter to user website using http://www.1freecounter.com'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total><georss:featurename>New Delhi, Delhi, India</georss:featurename><georss:point>28.635308 77.22496000000001</georss:point><georss:box>28.405279999999998 76.9810245 28.865336 77.468895500000016</georss:box></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-7827827176719063647</id><published>2011-09-08T00:19:00.001-07:00</published><updated>2012-06-02T14:33:47.947-07:00</updated><title type='text'>code in asp.net to send sms</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/7827827176719063647/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/09/code-in-aspnet-to-send-sms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/7827827176719063647'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/7827827176719063647'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/09/code-in-aspnet-to-send-sms.html' title='code in asp.net to send sms'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-7280691857956937128</id><published>2011-08-08T12:08:00.001-07:00</published><updated>2011-08-08T12:08:13.624-07:00</updated><title type='text'>using grid view</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&amp;lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; &amp;nbsp;CodeFile=&quot;Default.aspx.cs&quot; Inherits=&quot;_Default&quot; %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &amp;gt;&lt;br /&gt;
&amp;lt;head runat=&quot;server&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;Untitled Page&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:GridView ID=&quot;GridView1&quot; runat=&quot;server&quot; AllowPaging=&quot;True&quot; AllowSorting=&quot;True&quot; AutoGenerateColumns=&quot;False&quot; DataSourceID=&quot;SqlDataSource1&quot; DataKeyNames=&quot;branch_id&quot; AutoGenerateDeleteButton=&quot;True&quot; AutoGenerateEditButton=&quot;True&quot; style=&quot;z-index: 100; left: 271px; position: absolute; top: 367px&quot; BackColor=&quot;White&quot; BorderColor=&quot;#CCCCCC&quot; BorderStyle=&quot;None&quot; BorderWidth=&quot;1px&quot; CellPadding=&quot;4&quot; ForeColor=&quot;Black&quot; GridLines=&quot;Horizontal&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;Columns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:CommandField ShowSelectButton=&quot;True&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:BoundField DataField=&quot;branch_id&quot; HeaderText=&quot;Branch Id&quot; &amp;nbsp;SortExpression=&quot;branch_id&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:BoundField DataField=&quot;branchAddress&quot; HeaderText=&quot;Branch Address&quot; &amp;nbsp;SortExpression=&quot;branchAddress&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:BoundField DataField=&quot;Branch_head&quot; HeaderText=&quot;Branch Head&quot; &amp;nbsp;SortExpression=&quot;Branch_head&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:BoundField DataField=&quot;branch_manpower&quot; HeaderText=&quot;Branch Manpower&quot; &amp;nbsp;SortExpression=&quot;branch_manpower&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/Columns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;FooterStyle BackColor=&quot;#CCCC99&quot; ForeColor=&quot;Black&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;SelectedRowStyle BackColor=&quot;#CC3333&quot; Font-Bold=&quot;True&quot; ForeColor=&quot;White&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;PagerStyle BackColor=&quot;White&quot; ForeColor=&quot;Black&quot; HorizontalAlign=&quot;Right&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;HeaderStyle BackColor=&quot;#333333&quot; Font-Bold=&quot;True&quot; ForeColor=&quot;White&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:SqlDataSource ID=&quot;SqlDataSource1&quot; runat=&quot;server&quot; ConnectionString=&quot;&amp;lt;%$ ConnectionStrings:web_trackersConnectionString %&amp;gt;&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SelectCommand=&quot;SELECT * FROM [branches]&quot; UpdateCommand=&quot;update branches set branch_id=@branch_id, branchAddress=@branchAddress, Branch_head=@Branch_head, Branch_manpower=@Branch_manpower where(branch_id=@branch_id)&quot; DeleteCommand =&quot;delete from branches where branch_id=@branch_id&quot;&amp;gt;&amp;lt;/asp:SqlDataSource&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/form&amp;gt;&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/7280691857956937128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/08/using-grid-view.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/7280691857956937128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/7280691857956937128'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/08/using-grid-view.html' title='using grid view'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-7705149285222152458</id><published>2011-08-01T20:28:00.001-07:00</published><updated>2011-08-01T20:28:21.115-07:00</updated><title type='text'>delete a record</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&amp;nbsp;SqlCommand cmd = new SqlCommand(&quot;delete emp_master where Employee_id=&#39;&quot; + TextBox1.Text+ &quot;&#39;&quot;, con);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.CommandType = System.Data.CommandType.Text;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; con.Open();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.ExecuteNonQuery();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; con.Close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label18.Text = &quot;Record deleted successfully&quot;;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/7705149285222152458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/08/delete-record.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/7705149285222152458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/7705149285222152458'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/08/delete-record.html' title='delete a record'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-182973990426345002</id><published>2011-08-01T20:27:00.001-07:00</published><updated>2011-08-01T20:27:27.326-07:00</updated><title type='text'>searching</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
SqlCommand cmd = new SqlCommand(&quot;select * from emp_master where Employee_id=&#39;&quot; + TextBox17.Text+ &quot;&#39;&quot;, con);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlDataAdapter da = new SqlDataAdapter(cmd);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataSet ds = new DataSet();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; da.Fill(ds);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ds.Tables[0].Rows.Count == 0)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label18.Text = &quot;Record not found&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox1.Text = ds.Tables[0].Rows[0][&quot;Employee_id&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox2.Text = ds.Tables[0].Rows[0][&quot;Name&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox3.Text = ds.Tables[0].Rows[0][&quot;Date_of_Birth&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox4.Text = ds.Tables[0].Rows[0][&quot;Date_of_joining&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DropDownList1.Text &amp;nbsp;= ds.Tables[0].Rows[0][&quot;Gender&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DropDownList2.Text = ds.Tables[0].Rows[0][&quot;Categoryorcaste&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox5.Text = ds.Tables[0].Rows[0][&quot;Dept_id&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox6.Text = ds.Tables[0].Rows[0][&quot;Designation_id&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox7.Text = ds.Tables[0].Rows[0][&quot;Grade_id&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox8.Text = ds.Tables[0].Rows[0][&quot;PAN_NO&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label18.Text = &quot;Record Found&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/182973990426345002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/08/searching.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/182973990426345002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/182973990426345002'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/08/searching.html' title='searching'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-934236793284748244</id><published>2011-08-01T20:26:00.000-07:00</published><updated>2011-08-01T20:26:13.438-07:00</updated><title type='text'>display customized    welcome msg using sessions</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&amp;nbsp;object sessionObject = Session[&quot;adminid&quot;];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (sessionObject != null)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label3.Text = sessionObject.ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/934236793284748244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/08/display-customized-welcome-msg-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/934236793284748244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/934236793284748244'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/08/display-customized-welcome-msg-using.html' title='display customized    welcome msg using sessions'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-5752148040368341303</id><published>2011-08-01T05:19:00.000-07:00</published><updated>2011-08-01T05:19:08.085-07:00</updated><title type='text'>new login logic.... courtesies  by mr. ankit verma</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 14px;&quot;&gt;SqlConnection con = new SqlConnection(&quot;server=ANKIT-PC;user id=sa;password=manager;database=db_dda;&quot;);&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #333333; font-family: &#39;lucida grande&#39;, tahoma, verdana, arial, sans-serif; font-size: 11px; line-height: 14px;&quot;&gt;SqlDataAdapter da = new SqlDataAdapter(&quot;select * from adm_login where adm_id=&#39;&quot; + TextBox2.Text + &quot;&#39; and adm_pwd=&#39;&quot; + TextBox1.Text + &quot;&#39;&quot;, con);&lt;br /&gt;
con.Open();&lt;br /&gt;
DataSet ds=new DataSet();&lt;br /&gt;
da.Fill(ds);&lt;br /&gt;
if (ds.Tables[0].Rows.Count == 0)&lt;br /&gt;
Label3.Text = &quot;Invalid&quot;;&lt;br /&gt;
else&lt;br /&gt;
Label3.Text = &quot;Valid&quot;;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/5752148040368341303/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/08/new-login-logic-courtesies-by-mr-ankit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/5752148040368341303'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/5752148040368341303'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/08/new-login-logic-courtesies-by-mr-ankit.html' title='new login logic.... courtesies  by mr. ankit verma'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-1896800334578892093</id><published>2011-07-30T12:16:00.003-07:00</published><updated>2011-07-30T12:16:48.046-07:00</updated><title type='text'>Save data to dabase</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlConnection con = new SqlConnection(&quot;server=YASH-BA85E3332D\\SQLEXPRESS;database=db_dda;trusted_connection=yes;&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand(&quot;insert into houseing_booking( application_n,f_name,l_name,age,dob,address,phone,housing_scheme_name,house_category,advance_draft_amount,issuing_bank,draft_no,dd_date,date_of_application,bank_ac_number)values (@application_n,@f_name,@l_name,@age,@dob,@address,@phone,@housing_scheme_name,@house_category,@advance_draft_amount,@issuing_bank,@draft_no,@dd_date,@date_of_application,@bank_ac_number)&quot;, con);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataSet ds = new DataSet();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlDataAdapter adp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.CommandType = System.Data.CommandType.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@application_n&quot;, SqlDbType.Int).Value = int.Parse(TextBox1.Text);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@f_name&quot;, SqlDbType.VarChar).Value = TextBox2.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@l_name&quot;, SqlDbType.VarChar).Value = TextBox3.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@age&quot;, SqlDbType.Int).Value = int.Parse(TextBox4.Text);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@dob&quot;, SqlDbType.DateTime).Value = TextBox5.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@address&quot;, SqlDbType.VarChar).Value = TextBox6.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@phone&quot;, SqlDbType.Int).Value = int.Parse(TextBox7.Text);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@housing_scheme_name&quot;, SqlDbType.VarChar).Value = TextBox8.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@house_category&quot;, SqlDbType.VarChar).Value = TextBox9.Text;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@advance_draft_amount&quot;, SqlDbType.Int).Value = int.Parse(TextBox10.Text);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@issuing_bank&quot;, SqlDbType.VarChar).Value = TextBox11.Text;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@draft_no&quot;,SqlDbType.Int).Value = int.Parse(TextBox12.Text);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@dd_date&quot;, SqlDbType.DateTime).Value = TextBox13.Text;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@date_of_application&quot;, SqlDbType.DateTime).Value = TextBox14.Text;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@bank_ac_number&quot;, SqlDbType.VarChar).Value = TextBox15.Text;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adp = new SqlDataAdapter(cmd);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adp.Fill(ds, &quot;houseing_booking&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label19.Text=&quot;Congratulation Booking Confirmed!!!!!!&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox1.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox2.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox3.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox4.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox5.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox6.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox7.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox8.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox9.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox10.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox11.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox12.Text=&quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox13.Text=&quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox14.Text=&quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox15.Text = &quot;&quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch (SqlException se)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (se.ErrorCode == 2627)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label19.Text = &quot; Application No. already exists in database&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label19.Text=&quot;Exception occured !!!! Plz reload and try again later&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; finally&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/1896800334578892093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/07/save-data-to-dabase.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/1896800334578892093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/1896800334578892093'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/07/save-data-to-dabase.html' title='Save data to dabase'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-1721087208524868065</id><published>2011-07-30T12:16:00.001-07:00</published><updated>2012-06-02T14:33:47.899-07:00</updated><title type='text'>Save data to dabase</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlConnection con = new SqlConnection(&quot;server=YASH-BA85E3332D\\SQLEXPRESS;database=db_dda;trusted_connection=yes;&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand(&quot;insert into houseing_booking( application_n,f_name,l_name,age,dob,address,phone,housing_scheme_name,house_category,advance_draft_amount,issuing_bank,draft_no,dd_date,date_of_application,bank_ac_number)values (@application_n,@f_name,@l_name,@age,@dob,@address,@phone,@housing_scheme_name,@house_category,@advance_draft_amount,@issuing_bank,@draft_no,@dd_date,@date_of_application,@bank_ac_number)&quot;, con);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataSet ds = new DataSet();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlDataAdapter adp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.CommandType = System.Data.CommandType.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@application_n&quot;, SqlDbType.Int).Value = int.Parse(TextBox1.Text);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@f_name&quot;, SqlDbType.VarChar).Value = TextBox2.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@l_name&quot;, SqlDbType.VarChar).Value = TextBox3.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@age&quot;, SqlDbType.Int).Value = int.Parse(TextBox4.Text);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@dob&quot;, SqlDbType.DateTime).Value = TextBox5.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@address&quot;, SqlDbType.VarChar).Value = TextBox6.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@phone&quot;, SqlDbType.Int).Value = int.Parse(TextBox7.Text);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@housing_scheme_name&quot;, SqlDbType.VarChar).Value = TextBox8.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@house_category&quot;, SqlDbType.VarChar).Value = TextBox9.Text;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@advance_draft_amount&quot;, SqlDbType.Int).Value = int.Parse(TextBox10.Text);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@issuing_bank&quot;, SqlDbType.VarChar).Value = TextBox11.Text;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@draft_no&quot;,SqlDbType.Int).Value = int.Parse(TextBox12.Text);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@dd_date&quot;, SqlDbType.DateTime).Value = TextBox13.Text;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@date_of_application&quot;, SqlDbType.DateTime).Value = TextBox14.Text;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Add(&quot;@bank_ac_number&quot;, SqlDbType.VarChar).Value = TextBox15.Text;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adp = new SqlDataAdapter(cmd);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; adp.Fill(ds, &quot;houseing_booking&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label19.Text=&quot;Congratulation Booking Confirmed!!!!!!&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox1.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox2.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox3.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox4.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox5.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox6.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox7.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox8.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox9.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox10.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox11.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox12.Text=&quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox13.Text=&quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox14.Text=&quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox15.Text = &quot;&quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; catch (SqlException se)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (se.ErrorCode == 2627)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label19.Text = &quot; Application No. already exists in database&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label19.Text=&quot;Exception occured !!!! Plz reload and try again later&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; finally&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/1721087208524868065/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/07/save-data-to-dabase_30.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/1721087208524868065'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/1721087208524868065'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/07/save-data-to-dabase_30.html' title='Save data to dabase'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-8355403942046559214</id><published>2011-07-08T20:16:00.000-07:00</published><updated>2011-07-08T20:16:45.029-07:00</updated><title type='text'>login without session&#39;s implementaiton</title><content type='html'>protected void Button1_Click(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int i=0;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlConnection con = new SqlConnection(&quot;server=YASH-BA85E3332D\\SQLEXPRESS;database=db_dda;trusted_connection=yes;&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;SqlCommand &amp;nbsp;cmd =new SqlCommand(&quot;select * from adm_login&quot;,con);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlDataAdapter da=new SqlDataAdapter(cmd);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataSet ds=new DataSet();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; da.Fill(ds);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string dlogin;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string dpassword;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int lrecord;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dlogin = ds.Tables[0].Rows[i][&quot;adm_id&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dpassword = ds.Tables[0].Rows[i][&quot;adm_pwd&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lrecord = ds.Tables[0].Rows.Count;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; while (i &amp;lt; lrecord)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (TextBox1.Text == dlogin &amp;amp;&amp;amp; TextBox2.Text == dpassword)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Redirect(&quot;admin_pages\\admin_main_page.aspx&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; i++;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (i &amp;lt; lrecord)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dlogin = ds.Tables[0].Rows[i][&quot;adm_id&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dpassword = ds.Tables[0].Rows[i][&quot;adm_pwd&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Label3.Text=&quot;Invalid User id or Password&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/8355403942046559214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/07/login-without-sessions-implementaiton.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/8355403942046559214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/8355403942046559214'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/07/login-without-sessions-implementaiton.html' title='login without session&#39;s implementaiton'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-4303134253784702119</id><published>2011-07-06T11:07:00.000-07:00</published><updated>2011-07-06T11:07:17.817-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Contact me for other files"/><title type='text'>Create DHTML menus in asp.net</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&amp;lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeFile=&quot;Default2.aspx.cs&quot; Inherits=&quot;Default2&quot; %&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &amp;gt;&lt;br /&gt;
&amp;lt;head&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html;charset=utf-8&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;title&amp;gt;My menus&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;link type=&quot;text/css&quot; href=&quot;menu.css&quot; rel=&quot;stylesheet&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script type=&quot;text/javascript&quot; src=&quot;jquery.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script type=&quot;text/javascript&quot; src=&quot;menu.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;style type=&quot;text/css&quot;&amp;gt;&lt;br /&gt;
* { margin:0;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; padding:0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
body { background:#000; }&lt;br /&gt;
div#menu {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; top:40px;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; left:0px;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; width:100%;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/style&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&amp;lt;body style=&quot;background-color: white&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div id=&quot;menu&quot; style=&quot;left: 120px; top: 57px&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;ul class=&quot;menu&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; class=&quot;parent&quot;&amp;gt;&amp;lt;span&amp;gt;Home&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; class=&quot;parent&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; class=&quot;parent&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.1&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.1.1&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.1.2&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.2&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.3&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.4&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.5&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.6&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; class=&quot;parent&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.7&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.7.1&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.7.2&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 2&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 3&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; class=&quot;parent&quot;&amp;gt;&amp;lt;span&amp;gt;Product Info&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; class=&quot;parent&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.1&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 1.2&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot; class=&quot;parent&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 2&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div&amp;gt;&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 2.1&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 2.2&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 3&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 4&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 5&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 6&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Sub Item 7&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ul&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Help&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;li class=&quot;last&quot;&amp;gt;&amp;lt;a href=&quot;#&quot;&amp;gt;&amp;lt;span&amp;gt;Contacts&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/ul&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;asp:Label ID=&quot;Label1&quot; runat=&quot;server&quot; BackColor=&quot;Red&quot; Height=&quot;37px&quot; Text=&quot;Label&quot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Width=&quot;257px&quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/4303134253784702119/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/07/create-dhtml-menus-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/4303134253784702119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/4303134253784702119'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/07/create-dhtml-menus-in-aspnet.html' title='Create DHTML menus in asp.net'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-493162193137965851</id><published>2011-07-02T20:10:00.000-07:00</published><updated>2011-07-02T20:10:51.851-07:00</updated><title type='text'>How To search make work</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
SqlCommand cmd = new SqlCommand(&quot;select * from emp_sal where emp_id=&quot;+TextBox17.Text, con);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlDataAdapter da = new SqlDataAdapter(cmd);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataSet ds = new DataSet();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; da.Fill(ds);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ds.Tables[0].Rows.Count == 0)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label18.Text = &quot;Record Not found&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox1.Text = ds.Tables[0].Rows[0][&quot;emp_id&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox2.Text = ds.Tables[0].Rows[0][&quot;basic_salary&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox3.Text = ds.Tables[0].Rows[0][&quot;hra&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox4.Text = ds.Tables[0].Rows[0][&quot;da&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox5.Text = ds.Tables[0].Rows[0][&quot;ta&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox6.Text = ds.Tables[0].Rows[0][&quot;emp_grade&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox7.Text = ds.Tables[0].Rows[0][&quot;pf_reduction&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox8.Text = ds.Tables[0].Rows[0][&quot;pf_amount&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox9.Text = ds.Tables[0].Rows[0][&quot;pension_benifits&quot;].ToString();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox11.Text = ds.Tables[0].Rows[0][&quot;medical_benifits&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox12.Text = ds.Tables[0].Rows[0][&quot;total_salary&quot;].ToString();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/493162193137965851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/07/how-to-search-make-work.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/493162193137965851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/493162193137965851'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/07/how-to-search-make-work.html' title='How To search make work'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-8154859404505324731</id><published>2011-07-02T19:43:00.001-07:00</published><updated>2011-07-02T19:43:05.078-07:00</updated><title type='text'>How to Use File Upload Control in asp.net</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
if (FileUpload1.HasFile)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; FileUpload1.SaveAs(&quot;c:\\yash\\&quot; + FileUpload1.PostedFile.FileName);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(&quot;&amp;lt;script&amp;gt; alert(&#39;file Uploaded Sucessfully&#39;) &amp;lt;/script&amp;gt;&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/8154859404505324731/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/07/how-to-use-file-upload-control-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/8154859404505324731'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/8154859404505324731'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/07/how-to-use-file-upload-control-in.html' title='How to Use File Upload Control in asp.net'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-8593598602043085141</id><published>2011-06-21T22:47:00.000-07:00</published><updated>2011-06-21T22:47:30.229-07:00</updated><title type='text'>connectivity of oracle and c#</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.ComponentModel;&lt;br /&gt;
using System.Data;&lt;br /&gt;
using System.Drawing;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System.Windows.Forms;&lt;br /&gt;
using Microsoft.Data.Odbc;&lt;br /&gt;
namespace WindowsApplication12&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public partial class Form1 : Form&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Form1()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; InitializeComponent();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private void Form1_Load(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;OdbcConnection con=new OdbcConnection (&quot;driver={microsoft odbc for oracle};uid=scott;pwd=tiger;&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; OdbcCommand cmd=new OdbcCommand (&quot;select * from emp&quot;,con );&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; OdbcDataAdapter da=new OdbcDataAdapter (cmd);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataSet ds=new DataSet();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; da.Fill(ds);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; dataGridView1.DataSource &amp;nbsp;= ds.Tables[0];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/8593598602043085141/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/06/connectivity-of-oracle-and-c.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/8593598602043085141'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/8593598602043085141'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/06/connectivity-of-oracle-and-c.html' title='connectivity of oracle and c#'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3375969267344467.post-8479822716767130045</id><published>2011-01-24T06:36:00.001-08:00</published><updated>2011-01-25T04:04:10.380-08:00</updated><title type='text'>create E-mail service in asp.net</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #37414b; font-family: mono; font-size: 13px; line-height: 18px;&quot;&gt;private void btnSend_Click(object sender, System.EventArgs e)&amp;nbsp;&amp;nbsp;{&lt;br /&gt;
MailMessage msg = new MailMessage();&lt;br /&gt;
msg.To = this.txtTo.Text;&lt;br /&gt;
msg.Subject = this.txtSubject.Text;&lt;br /&gt;
msg.Body = this.txtBody.Text;&lt;br /&gt;
msg.From = &quot;info@Builder.com&quot;;&lt;br /&gt;
SmtpMail.SmtpServer = &quot;localhost&quot;;&lt;br /&gt;
SmtpMail.Send(msg);&lt;br /&gt;
}&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://yashlxy.blogspot.com/feeds/8479822716767130045/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://yashlxy.blogspot.com/2011/01/create-e-mail-service-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/8479822716767130045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3375969267344467/posts/default/8479822716767130045'/><link rel='alternate' type='text/html' href='http://yashlxy.blogspot.com/2011/01/create-e-mail-service-in-aspnet.html' title='create E-mail service in asp.net'/><author><name>Yash</name><uri>http://www.blogger.com/profile/15630989122541394744</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiihPGGAoKnz6Ot8ydNQGYIKpRIkKjpnlGYOlNncJeDEgrV_bNzG9g101dDGzQvdis26tRZeTbDPSN_WgDBDhFMU-oRk4TkR7Y1Rs_ikFXp5dgf5zdCeAnNldKiL_iZXQ/s220/yahspal.jpg'/></author><thr:total>0</thr:total></entry></feed>