<?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-3847585507953566840</id><updated>2026-06-26T08:15:43.304-07:00</updated><category term="ASP.NET"/><category term="Samsung Omnia w"/><category term="SQL Server 2008"/><category term="Extra blogs"/><category term="iphone"/><category term="Miscellaneous"/><category term="interview question in sql server"/><category term="ios"/><category term="windows 7"/><title type='text'>Krishan Kayat</title><subtitle type='html'>windows phone </subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>63</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-4500382879393180466</id><published>2018-07-11T20:40:00.000-07:00</published><updated>2018-07-11T20:40:21.333-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="interview question in sql server"/><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><title type='text'>How to find Nth highest salary in ms sql server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;i&gt;&lt;span style=&quot;font-size: large;&quot;&gt;some guys confused how to write a query for getting output in sql server.&lt;/span&gt;&lt;/i&gt;&lt;div&gt;
&lt;i&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;span style=&quot;font-size: large;&quot;&gt;there are so many way to get Nth salary .......... i am explaining two ways below find :&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;
&lt;div&gt;
&lt;i&gt;&lt;span style=&quot;font-size: large;&quot;&gt;select * from (select&amp;nbsp; Dense_Rank() over (order by &lt;span style=&quot;background-color: #f6d5d9;&quot;&gt;salary&amp;nbsp;&lt;/span&gt;desc) as denserank,salary from SalaryMaster) as r where denserank=&lt;/span&gt;&lt;/i&gt;&lt;b&gt;Value&amp;nbsp;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Value=on which position rank you want i.e. 2 or 5th&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;this is a Dense_Rank() function which gives you a sequence without skipping a number order. this is the best way to get Nth salary in a query.&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;--------------------------------------------------------------------&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;2nd way.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&amp;nbsp;with CTE&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;with CTESalary&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;AS&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;(&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;Dense_Rank() over (order by salary desc)as denserank,&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;,salary from SalaryMaster&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;)&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;select * from CTESalary where denserank=2&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/4500382879393180466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2018/07/how-to-find-nth-highest-salary-in-ms.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/4500382879393180466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/4500382879393180466'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2018/07/how-to-find-nth-highest-salary-in-ms.html' title='How to find Nth highest salary in ms sql server'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-2951688305445560173</id><published>2017-07-27T05:29:00.002-07:00</published><updated>2017-07-27T05:32:12.131-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="iphone"/><title type='text'>iphone review</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;lt;iframe style=&quot;width:120px;height:240px;&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; src=&quot;//ws-in.amazon-adsystem.com/widgets/q?ServiceVersion=20070822&amp;amp;OneJS=1&amp;amp;Operation=GetAdHtml&amp;amp;MarketPlace=IN&amp;amp;source=ac&amp;amp;ref=tf_til&amp;amp;ad_type=product_link&amp;amp;tracking_id=cseindia-21&amp;amp;marketplace=amazon&amp;amp;region=IN&amp;amp;placement=B01NCN4ICO&amp;amp;asins=B01NCN4ICO&amp;amp;linkId=d39f0222a89bd1714f411d1b6fcc047a&amp;amp;show_border=false&amp;amp;link_opens_in_new_window=false&amp;amp;price_color=333333&amp;amp;title_color=0066c0&amp;amp;bg_color=ffffff&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/iframe&amp;gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/2951688305445560173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2017/07/stylewidth120pxheight240px-marginwidth0.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/2951688305445560173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/2951688305445560173'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2017/07/stylewidth120pxheight240px-marginwidth0.html' title='iphone review'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-4206840190202619466</id><published>2017-04-14T03:45:00.001-07:00</published><updated>2017-04-14T03:45:20.233-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ios"/><category scheme="http://www.blogger.com/atom/ns#" term="iphone"/><title type='text'>Unable to add google gmail in iphone </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hello guys,&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;i deleted my account and tried to add again but i was facing problem when i was entering my username and password then screen was flashing once then again go to choose option screen .&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
solution is you&#39;ll get micro second to save your setting . when you entered your details then screen will show save button upper right corner. then quickly press save button and you&#39;ll see your account has been added. thnx . hope it&#39;ll helpful.&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/4206840190202619466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2017/04/unable-to-add-google-gmail-in-iphone.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/4206840190202619466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/4206840190202619466'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2017/04/unable-to-add-google-gmail-in-iphone.html' title='Unable to add google gmail in iphone '/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-2174125341758225623</id><published>2016-08-01T05:46:00.004-07:00</published><updated>2016-08-01T05:46:43.689-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><title type='text'>Understanding ASP.NET MVC using real world example, for beginners and intermediate</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;header class=&quot;entry-header&quot;&gt;&lt;h1 class=&quot;entry-title&quot;&gt;
ASP.NET MVC&lt;/h1&gt;
&lt;/header&gt;&lt;div class=&quot;entry-content&quot;&gt;
First thing is to understand the &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC framework itself, once we’ve gotten enough understanding of the &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC framework, then it would be a lot easy for us to understand why &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; team provided us with this framework. In web development, there are different schemes used to create web sites and web applications, which at a minor age don’t seem to cause a problem. Solving a bug might take hours of headscratching and some other help too. It is harder to find the problem that is scripted inside the HTML web page. In these scenarios, it is always found helpfull to seperate your code from your data and from your HTML markup. This would make it a lot easier to find and solve the problem. Because, now all of the code has been seperated and finding the problem at exact location won’t be a harder task. These three fields are divided and make up the MVC; Model, View and Controller pattern for web development.&lt;br /&gt;
&lt;em&gt;Actually this is not a pattern, specific to the web development. If you go to Wikipedia’s web page for this, you will find that it is actually a framework used for software development, meaning that it can be applied anywhere, where you want to distinguish between your application’s data link layer, business logic layer and the rendering code.&lt;/em&gt;&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_239&quot; style=&quot;width: 283px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/mvc-process-svg.png&quot;&gt;&lt;img alt=&quot;MVC-Process.svg&quot; class=&quot;wp-image-239 size-medium&quot; height=&quot;300&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/mvc-process-svg.png?w=273&amp;amp;h=300&quot; width=&quot;273&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
The link between these three objects of MVC pattern have been depicted in this image above.&lt;/div&gt;
&lt;/div&gt;
&lt;h4&gt;
Controller&lt;/h4&gt;
The Controller in the MVC comes at the last, but is the most used part of the MVC pattern. It is used to work with the HTTP requests, coming from the clients; from the browsers &amp;nbsp;or from any other application that can generate an HttpRequest (not to be confused with the .NET’s HttpRequest object; but a simple HTTP Request). Each request, when comes, is handled by the Controller and then Controller, according to the request makes decisions to load the data, create the response and then sends the data back to the client.&lt;br /&gt;
It should also be noted here, that your Controller acts as a bridge between your Model and the View. Because they, as themself, cannot perform any action. Controller triggers their events and makes them do something, like return data from Model, or to render the HTML document from the View etc. All of the resources and errors are also handled by the Controller. Making it the heart of the pattern, because the response is also sent back from a controller. You can think of an example of a Controller to be the entire Business-logic-layer. The code that is used to run the application’s back-end processing, like creating accounts, managing solutions etc, would make up the Controller section of this pattern.&lt;br /&gt;
&lt;h4&gt;
View&lt;/h4&gt;
Next comes the part of the View, this is the actual web page that is being displayed to the user. It contains the HTML codes that are to be sent back to the data as a response to his request. Correct, Controller sends this response back to the client, View – its self – doesn’t send this response to client whereas Controllers takes this data, and sends back to the client.&lt;br /&gt;
View, can also be created dynamically. As already said, all of the requests are handled by Controller, so any parameter (including QueryStrings) can also be handled by Controllers. Using these parameters, we can generate dynamic Views. So dynamic content in our view, change their layouts or show some other error messages if the data sent is not of our own choice. View, generally depends on the Model that is being used to create the View and these dynamic data objects are capture from the Model (Model is discussed in the next section).&lt;br /&gt;
&lt;em&gt;Point to be noted here is that while section-in-action is View, still Controller is playing a vital role for passing the values and for retrieving the data to be sent to client.&amp;nbsp;&lt;/em&gt;&lt;br /&gt;
&lt;h4&gt;
Model&lt;/h4&gt;
As the name suggests, it is a model of some object. The object in this case is our application’s data. It can be of any type, like extracted from a database; no matter which one, SQL Server, MySQL or MS Access etc, or it can be a simple data that comes from a Reporting, or from a Spreadsheet etc. Model is never shown to the user (actually, the client) because he is supposed to see the data and the results we want him to see, that is why, it is a good approach to keep a great abstraction layer between Model and the user (the client).&lt;br /&gt;
Model doesn’t only store the data, it – at the same time – keeps the View and the Controller updated or any change being made to it. Models are designed, just like Controllers and Views are designed, just so that there is no ambiguity between three of them and it &amp;nbsp;is easy for them to communicate to make the web application fluent. Everytime a change is made, View is update by the Controller, because Controller is informed about the change (this informing event is also raised by Controller; as I already said, Controller handles the events). To store anything in the Model, the user has not been provided with any form that is directly connected to the Model, instead a form is generated in the View by the Controller for the user to fill in. Once the form is filled, the form values are then passed to the model for storing purposes. All kinds of data validations (most special type of which are &lt;a href=&quot;https://en.wikipedia.org/wiki/SQL_injection&quot; title=&quot;Wikipedia&quot;&gt;SQL Injections&lt;/a&gt;) can be checked at the Controller level rather than loosing (important) data.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_240&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/mvc_role_diagram.png&quot;&gt;&lt;img alt=&quot;The user must be allowed to interact with Model himself, instead a Controller must be used to connect to the Model to get the data for the user&#39;s View that would be shown to him. &quot; class=&quot;size-medium wp-image-240&quot; height=&quot;138&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/mvc_role_diagram.png?w=300&amp;amp;h=138&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
The user must be allowed to interact with Model himself, instead a Controller must be used to connect to the Model to get the data for the user’s View that would be shown to him.&lt;/div&gt;
&lt;/div&gt;
Until now, we’ve been discussing the &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC itself, in the next section we will be discussing a real-world example of an &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC Application, and I will show how to create custom Controllers, Views and Models. In an &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC project a user triggers the Controller, the controller then reads and manipulates the requests, Requests the Model for data, gets the data and then Updates the View to be sent back to the client.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_242&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/mvc.png&quot;&gt;&lt;img alt=&quot;Overview of MVC pattern.&quot; class=&quot;size-medium wp-image-242&quot; height=&quot;197&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/mvc.png?w=300&amp;amp;h=197&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
Overview of MVC pattern.&lt;/div&gt;
&lt;/div&gt;
&lt;h2&gt;
Real world example of ASP.NET MVC Application&lt;/h2&gt;
In this blog &amp;nbsp;post, I am going to explain creating an MVC application to control your client’s data. For that, I am going to use the Model, View and Controller architecture, so that I can easily distinguish between the data of my application (which would be the data for the clients), code for the requests and responses (which would constitute the controller) and how the data is shown to the users (views of my application). I am going to create everything from scratch, to make every thing understandable for you. For that I am going to start from creating every single &amp;nbsp;object in my application, every controller, every view and model in my project.&lt;br /&gt;
One thing you should think about here is that I am going to use JSON files as data source, because database field has already been covered by the &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; team at its best. I don’t think there is any need to re-write the same thing, that is why I am going to explain how to use &lt;em&gt;anything as your model&lt;/em&gt;. If you want to read that one, and want to stick to SQL Server database you can go to &lt;a href=&quot;http://www.asp.net/mvc/overview/getting-started/introduction/getting-started&quot; title=&quot;ASP.NET MVC website&quot;&gt;ASP.NET MVC’s tutorial&lt;/a&gt; website to learn that. You’re right, &lt;a href=&quot;http://www.asp.net/entity-framework&quot;&gt;Entity framework&lt;/a&gt; won’t be supported here! That is why I am saying I am going to create everything from scratch, to explain every bit of the MVC pattern for you and how you can create actions that respond to &lt;em&gt;your actual processes&lt;/em&gt;, not just to the built-in ones.&lt;br /&gt;
&lt;h4&gt;
Real-life example&lt;/h4&gt;
Let’s have an example of a simple office, where a person gets different clients, whose name, address is stored. Just to distinguish them all, an ID is also stored. Whether the client is trusted or not, is also stored along with him. Office manager wants to be able to, create new clients, modify the existing ones, and once he is done with them he wants to be able to delete the previous ones. To implement this basic example in &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC, we will start off by creating a simple &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC application. To do so, you can either press CTRL+SHIFT+N, or you can click on File, then New and a Project. Like this,&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_246&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-156.png&quot;&gt;&lt;img alt=&quot;Creating a new project - in Visual Studio 2013&quot; class=&quot;size-medium wp-image-246&quot; height=&quot;204&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-156.png?w=300&amp;amp;h=204&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
Creating a new project – in Visual Studio 2013&lt;/div&gt;
&lt;/div&gt;
After this, please select the Web and inside select &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; Web Application, then name it as you want. I named it, ASPNET_MVC_Application. You can use any name that you want.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_247&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-157.png&quot;&gt;&lt;img alt=&quot;Selecting an ASP.NET web application. &quot; class=&quot;size-medium wp-image-247&quot; height=&quot;182&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-157.png?w=300&amp;amp;h=182&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
Selecting an &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; web application.&lt;/div&gt;
&lt;/div&gt;
Then you will be required to make the selections for your application in the next tab. You shouldn’t make any change for now, keep the selected options selected and click Next on this tab.&lt;br /&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-160.png&quot;&gt;&lt;img alt=&quot;Screenshot (160)&quot; class=&quot;alignnone size-medium wp-image-248&quot; height=&quot;222&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-160.png?w=300&amp;amp;h=222&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
This would then create your application, with the default content for your application settings. You might see this web page inside your Visual Studio.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_249&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-161.png&quot;&gt;&lt;img alt=&quot;ASP.NET MVC read me page viewed inside the Visual Studiom 2013 - application&#39;s first run.&quot; class=&quot;size-medium wp-image-249&quot; height=&quot;160&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-161.png?w=300&amp;amp;h=160&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
&lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC read me page viewed inside the Visual Studiom 2013 – application’s first run.&lt;/div&gt;
&lt;/div&gt;
This is the tutorial until creation of the application. This web page is also a sign of success, if you still want to make sure that everything runs, just press the green button (with a Browser’s name on it; mine had Google Chrome) to see your application runs in the browser. In the next section, I will be creating the application’s objects (MVC) and then showing you how they can interact and in the end I will give some tips for making your application better.&lt;br /&gt;
&lt;h2&gt;
Customizing&amp;nbsp;the ASP.NET MVC Application&lt;/h2&gt;
Once all of the things are set, and your application runs. You can continue to make changes to it, so that it would reflect your own application and not the default &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC application that is a sample. First thing to do is to create a controller which we’re going to be using inside our application to control all of the requests and is going to send back the response (view). How to create views and what would be the model will be covered in coming sections. For now, just make up your mind to understand the Controller in MVC.&lt;br /&gt;
&lt;strong&gt;Required&amp;nbsp;package&lt;/strong&gt;: Since we’re going to use JSON data, &lt;span class=&quot;skimlinks-unlinked&quot;&gt;Newtonsoft.Json&lt;/span&gt; package is a very usefull package to use, so before you go any further open your NuGet package manager console (inside the Tools) and run the following command to download and include it in your project. &lt;em&gt;It is required.&lt;/em&gt;&lt;br /&gt;
&lt;pre&gt;Install-Package &lt;span class=&quot;skimlinks-unlinked&quot;&gt;Newtonsoft.Json&lt;/span&gt;&lt;/pre&gt;
&lt;h4&gt;
Creating a custom Controller&lt;/h4&gt;
A custom controller is something that you can use to create your custom controllers for your application, that would handle the requests coming for them and they will provide the user with a view filled in with the data from the model. You can name them as you would like to name them, there is no convention; but just one convention which is to append “Controller” to the name of the class. Controller is a class in real which inherits from &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.Web.Mvc.Controller&lt;/span&gt; class, making it able to inherit all of the functions and members of the Controller (parent) class. Let us create a Controller. Inside your Source code, there is a folder named as Controllers. If you open it, there would be 3&amp;nbsp;controllers by default, you can create your own.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_250&quot; style=&quot;width: 218px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-167.png&quot;&gt;&lt;img alt=&quot;Default controllers in ASP.NET MVC application&quot; class=&quot;size-full wp-image-250&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-167.png?w=625&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
Default controllers in &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC application&lt;/div&gt;
&lt;/div&gt;
Right click on Controller folder and inside the Add option, click Controller to create a new one.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_251&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-168.png&quot;&gt;&lt;img alt=&quot;Creating a new Controller&quot; class=&quot;size-medium wp-image-251&quot; height=&quot;137&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-168.png?w=300&amp;amp;h=137&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
Creating a new Controller&lt;/div&gt;
&lt;/div&gt;
Give a custom name to your controller; remember to have that Controller at the end of your class’ name. You must create an empty controller, because for the sake of this post we’re not going to use anything &lt;em&gt;built-in&lt;/em&gt; but just scratch classes.&lt;br /&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-170.png&quot;&gt;&lt;img alt=&quot;Screenshot (170)&quot; class=&quot;alignnone size-medium wp-image-252&quot; height=&quot;61&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-170.png?w=300&amp;amp;h=61&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_253&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-169.png&quot;&gt;&lt;img alt=&quot;We just need an Empty controller, to create our own functions (actions in MVC) for it to handle and perform.&quot; class=&quot;size-medium wp-image-253&quot; height=&quot;207&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-169.png?w=300&amp;amp;h=207&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
We just need an Empty controller, to create our own functions (actions in MVC) for it to handle and perform.&lt;/div&gt;
&lt;/div&gt;
At this stage, your basic Controller has been created and you’re now ready to customize it. Before we move on to create actions that this Controller would perform. I wanted to remind you about (automatic) changes that were made in your Views folder. What Views folder is about, is – yes, well – self-explainatory but we’ll be talking about it too in the coming section. Right now, there is a new Client (or what ever Controller you create’s named) folder inside your View folder. Now it does start to make some sense, doesn’t it? Every controller has its own particular view to display data for, and each time the request would initiate from client (not our class, but the user of course) the Controller would be used (you can think like an instance of that class would be created) and then the Action of Controller would be checked against (inside the URL; which would then trigger the function of the Controller, which we’re going to create next). Like every class, we can create different functions for our Controllers, which are known as Actions. Let us think what we’re supposed to let our manager do with the client, he wants to&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Create a new client – Create&lt;/li&gt;
&lt;li&gt;Modify current client’s data – Update or Edit&lt;/li&gt;
&lt;li&gt;Delete clients when he has finished the work – Delete&lt;/li&gt;
&lt;/ol&gt;
We can use above logic to create our functions for the Client Controller. Open your &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ClientController.cs&lt;/span&gt; file and edit it, to write this code in it.&lt;br /&gt;
&lt;pre&gt;using System;
using System.Collections.Generic;
using &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.Linq&lt;/span&gt;;
using &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.Web&lt;/span&gt;;
using &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.IO&lt;/span&gt;;
using &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.Web.Mvc&lt;/span&gt;;

using ASP.NET_MVC_Application.Models;
using &lt;span class=&quot;skimlinks-unlinked&quot;&gt;Newtonsoft.Json&lt;/span&gt;;

namespace ASP.NET_MVC_Application.Controllers
{
   public class ClientController : Controller
   {
      // GET: Client
      public ActionResult Index()
      {
         // Load the data for the client
         var clients = Client.GetClients();

         // Return the view.
         return View(clients);
      }

      public ActionResult Create()
      {
         ViewBag.Submitted = false;
         var created = false;
         // Create the Client
         if (HttpContext.Request.RequestType == &quot;POST&quot;)
         {
            ViewBag.Submitted = true;
            // If the request is POST, get the values from the form
            var id = &lt;span class=&quot;skimlinks-unlinked&quot;&gt;Request.Form&lt;/span&gt;[&quot;id&quot;];
            var name = &lt;span class=&quot;skimlinks-unlinked&quot;&gt;Request.Form&lt;/span&gt;[&quot;name&quot;];
            var address = &lt;span class=&quot;skimlinks-unlinked&quot;&gt;Request.Form&lt;/span&gt;[&quot;address&quot;];
            var trusted = false;
 
            if(&lt;span class=&quot;skimlinks-unlinked&quot;&gt;Request.Form&lt;/span&gt;[&quot;trusted&quot;] == &quot;on&quot;) {
               trusted = true;
            }

            // Create a new Client for these details.
            Client client = new Client()
            {
               ID = Convert.ToInt16(id), 
               Name = name,
               Address = address,
               Trusted = Convert.ToBoolean(trusted)
            };

            // Save the client in the ClientList
            var ClientFile = Client.ClientFile;
            var ClientData = &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.IO.File.ReadAllText(ClientFile&lt;/span&gt;);
            List&amp;lt;Client&amp;gt; ClientList = new List&amp;lt;Client&amp;gt;();
            ClientList = JsonConvert.DeserializeObject&amp;lt;List&amp;lt;Client&amp;gt;&amp;gt;(ClientData);

            if (ClientList == null)
            {
               ClientList = new List&amp;lt;Client&amp;gt;();
            }
            &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ClientList.Add(client&lt;/span&gt;);

            // Now save the list on the disk
            &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.IO.File.WriteAllText(ClientFile&lt;/span&gt;, JsonConvert.SerializeObject(ClientList));

            // Denote that the client was created
            created = true;
         }

         if (created)
         {
            ViewBag.Message = &quot;Client was created successfully.&quot;;
         }
         else
         {
            ViewBag.Message = &quot;There was an error while creating the client.&quot;;
         }
       return View();
     }

     public ActionResult Update(int id)
     {
        if (HttpContext.Request.RequestType == &quot;POST&quot;)
        {
           // Request is Post type; must be a submit
           var name = &lt;span class=&quot;skimlinks-unlinked&quot;&gt;Request.Form&lt;/span&gt;[&quot;name&quot;];
           var address = &lt;span class=&quot;skimlinks-unlinked&quot;&gt;Request.Form&lt;/span&gt;[&quot;address&quot;];
           var trusted = &lt;span class=&quot;skimlinks-unlinked&quot;&gt;Request.Form&lt;/span&gt;[&quot;trusted&quot;];

           // Get all of the clients
           var clints = Client.GetClients();

           foreach (Client client in clints)
           {
              // Find the client
              if (&lt;span class=&quot;skimlinks-unlinked&quot;&gt;client.ID&lt;/span&gt; == id)
              {
                 // Client found, now update his properties and save it.
                 &lt;span class=&quot;skimlinks-unlinked&quot;&gt;client.Name&lt;/span&gt; = name;
                 client.Address = address;
                 client.Trusted = Convert.ToBoolean(trusted);
                 // Break through the loop
                 break;
              }
           }

           // Update the clients in the disk
           &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.IO.File.WriteAllText(Client.ClientFile&lt;/span&gt;, JsonConvert.SerializeObject(clints));

           // Add the details to the View
           Response.Redirect(&quot;~/Client/Index?Message=Client_Updated&quot;);
       }


       // Create a model object.
       var clnt = new Client();
       // Get the list of clients
       var clients = Client.GetClients();
       // Search within the clients
       foreach (Client client in clients)
       {
          // If the client&#39;s ID matches
          if (&lt;span class=&quot;skimlinks-unlinked&quot;&gt;client.ID&lt;/span&gt; == id)
          {
              clnt = client;
          }
          // No need to further run the loop
          break;
       }
       if (clnt == null)
       {
           // No client was found
           ViewBag.Message = &quot;No client was found.&quot;;
       }
     return View(clnt);
   }

   public ActionResult Delete(int id)
   {
      // Get the clients
      var Clients = Client.GetClients();
      var deleted = false;
      // Delete the specific one.
      foreach (Client client in Clients)
      {
        // Found the client
        if (&lt;span class=&quot;skimlinks-unlinked&quot;&gt;client.ID&lt;/span&gt; == id)
        {
          // delete this client
          var index = Clients.IndexOf(client);
          Clients.RemoveAt(index);

          // Removed now save the data back.
          &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.IO.File.WriteAllText(Client.ClientFile&lt;/span&gt;, JsonConvert.SerializeObject(Clients));
          deleted = true;
          break;
       }
    }

     // Add the process details to the ViewBag
     if (deleted)
     {
        ViewBag.Message = &quot;Client was deleted successfully.&quot;;
     }
     else
     {
        ViewBag.Message = &quot;There was an error while deleting the client.&quot;;
     }
     return View();
    }
  }
}&lt;/pre&gt;
Done! That was our controller, if you have a look at the code above you will find a few functions, a few ViewBags and a few Views etc. I will explain them in the end, because they’re built-in functions of &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC for the application and which we are bound to use them for application to run. Each time you’re going to create a request to your application to load data about clients, this controller would take action, and will provide with the data that user (in case here, you) want from the application. In the above code Create, Update, Delete and Index are the functions of the class, in MVC application they will act as Actions of the application’s Controller. You will use them to tell the application what to do, when user triggers such a particular action in your application. They’re just average functions in a simple class; which inherits from &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.Web.Mvc.Controller&lt;/span&gt;.&lt;br /&gt;
&lt;h4&gt;
Creating a custom View&lt;/h4&gt;
Now that back-end code (Controller code) has been done, and you can now create the Views for your application. Views are used to show the content (data) of your application to the client (user) in HTML markup. Because browser can only render HTML content, we will be using that markup, and Views are used for that. Each controller has its own particular view. One thing to note here, is that to return a View, the name of the View must match the Action’s name. You can put it, like each of the Action (function) in the Controller is meant for a particular View (HTML document to be returned) in the application. We, need four Views, for our four Actions; Index, Create, Update, Delete. To create a View you can click on the Views folder, and create a new folder; but remember, here you don’t need to create any new folder, because as I already said when you created the Controller a new folder was already created with the name of the Controller “Client”. Right-click that folder, and inside the Add click on the MVC 5 View with Layout and click Next to go to the next step.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_255&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-171.png&quot;&gt;&lt;img alt=&quot;Creating a new View (with Layout)&quot; class=&quot;size-medium wp-image-255&quot; height=&quot;139&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-171.png?w=300&amp;amp;h=139&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
Creating a new View (with Layout)&lt;/div&gt;
&lt;/div&gt;
Now name the View, I named it Index because we need a view for Index page.&lt;br /&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-172.png&quot;&gt;&lt;img alt=&quot;Screenshot (172)&quot; class=&quot;alignnone size-medium wp-image-256&quot; height=&quot;89&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-172.png?w=300&amp;amp;h=89&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Now select the layout, layout is applied across the pages (Views) to design them a like. You can use your own views too, but for this I am going to use the default layout.&amp;nbsp;&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-173.png&quot;&gt;&lt;img alt=&quot;Screenshot (173)&quot; class=&quot;alignnone size-medium wp-image-257&quot; height=&quot;183&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-173.png?w=300&amp;amp;h=183&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
This is the step-by-step method to create the View in &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC using Visual Studio. &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; uses Razor syntax to create HTML pages, which shortens the codes for the developers. Update the code inside this page and write this following code,&lt;br /&gt;
&lt;pre&gt;@model IEnumerable&amp;lt;ASPNET_MVC_Application.Models.Client&amp;gt;

@{
   &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ViewBag.Title&lt;/span&gt; = &quot;All Clients&quot;;
   Layout = &quot;~/Views/Shared/_Layout.cshtml&quot;;
}

&amp;lt;h3&amp;gt;Following table shows the Clients detail&amp;lt;/h3&amp;gt;
&amp;lt;p&amp;gt;You will find their details, as well as other links to other actions that can be performed and operated over the client objects. &amp;lt;/p&amp;gt;

&amp;lt;p&amp;gt;You can also create a new client &amp;lt;a href=&quot;~/Client/Create&quot;&amp;gt;here&amp;lt;/a&amp;gt;. &amp;lt;/p&amp;gt;

&amp;lt;table class=&quot;clients-table&quot;&amp;gt;
   &amp;lt;tr&amp;gt;
   &amp;lt;th&amp;gt;ID&amp;lt;/th&amp;gt;
   &amp;lt;th&amp;gt;Name&amp;lt;/th&amp;gt;
   &amp;lt;th&amp;gt;Address&amp;lt;/th&amp;gt;
   &amp;lt;th&amp;gt;Trusted&amp;lt;/th&amp;gt;
   &amp;lt;th&amp;gt;Actions&amp;lt;/th&amp;gt;
&amp;lt;/tr&amp;gt;

 @if(Model != null &amp;amp;&amp;amp; &lt;span class=&quot;skimlinks-unlinked&quot;&gt;Model.Count&lt;/span&gt;() &amp;gt; 0)
 {
   foreach (var client in Model)
   {
     // Create the list of these clients
     &amp;lt;tr&amp;gt;
       &amp;lt;td&amp;gt;@&lt;span class=&quot;skimlinks-unlinked&quot;&gt;client.ID&amp;lt;/td&lt;/span&gt;      &amp;lt;td&amp;gt;@&lt;span class=&quot;skimlinks-unlinked&quot;&gt;client.Name&amp;lt;/td&lt;/span&gt;      &amp;lt;td&amp;gt;@client.Address&amp;lt;/td&amp;gt;
       &amp;lt;td&amp;gt;@client.Trusted&amp;lt;/td&amp;gt;
       &amp;lt;td&amp;gt;
         &amp;lt;a href=&quot;~/Client/Update/@&lt;span class=&quot;skimlinks-unlinked&quot;&gt;client.ID&quot;&amp;gt;Update&amp;lt;/a&lt;/span&gt;&amp;lt;a href=&quot;~/Client/Delete/@&lt;span class=&quot;skimlinks-unlinked&quot;&gt;client.ID&quot;&amp;gt;Delete&amp;lt;/a&lt;/span&gt;td&amp;gt;
     &amp;lt;/tr&amp;gt; 
   }
 }
&amp;lt;/table&amp;gt;&lt;/pre&gt;
In the above page’s source code, you will find one new thing. @model IEnumerable&amp;lt;ASPNET_MVC_Application.Models.Client&amp;gt; that is the type of the data that has to be used inside this View; Yes, it is the model being used here. After that it is just simple razor syntax, to create the HTML document (View) and to return to the client (user). The Model object (the one used in the foreach loop) is having the value of what ever is passed for the @model thing.&lt;br /&gt;
You should create next three Views yourself (&lt;em&gt;as a test&lt;/em&gt;) and write this content to them.&lt;br /&gt;
&lt;strong&gt;For Create View&lt;/strong&gt;:&lt;br /&gt;
&lt;pre&gt;@{
   &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ViewBag.Title&lt;/span&gt; = &quot;Create&quot;;
   Layout = &quot;~/Views/Shared/_Layout.cshtml&quot;;
}

&amp;lt;div&amp;gt;
   &amp;lt;h3&amp;gt;Fill in the following form&amp;lt;/h3&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;form method=&quot;post&quot; style=&quot;margin: 5% 0 0&quot;&amp;gt;
   &amp;lt;div class=&quot;float-left&quot;&amp;gt;
     &amp;lt;p&amp;gt;Client ID&amp;lt;/p&amp;gt;
     &amp;lt;p&amp;gt;Name&amp;lt;/p&amp;gt;
     &amp;lt;p&amp;gt;Address&amp;lt;/p&amp;gt;
     &amp;lt;p&amp;gt;Trusted&amp;lt;/p&amp;gt;
   &amp;lt;/div&amp;gt;
   &amp;lt;div class=&quot;float-right&quot;&amp;gt;
     &amp;lt;input type=&quot;text&quot; style=&quot;margin: 1px 0 2px&quot; name=&quot;id&quot; /&amp;gt;&amp;lt;br /&amp;gt;
     &amp;lt;input type=&quot;text&quot; style=&quot;margin: 1px 0 2px&quot; name=&quot;name&quot; /&amp;gt;&amp;lt;br /&amp;gt;
     &amp;lt;input type=&quot;text&quot; style=&quot;margin: 1px 0 2px&quot; name=&quot;address&quot; /&amp;gt;&amp;lt;br /&amp;gt;
     &amp;lt;input type=&quot;checkbox&quot; style=&quot;margin: 1px 0 2px&quot; name=&quot;trusted&quot; /&amp;gt;&amp;lt;br /&amp;gt;
     &amp;lt;input type=&quot;submit&quot; value=&quot;Save&quot; /&amp;gt;
   &amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;

&amp;lt;p&amp;gt;
   @if (ViewBag.Submitted)
   {
     // If the form was submitted
     @ViewBag.Message
   }
&amp;lt;/p&amp;gt;&lt;/pre&gt;
&lt;strong&gt;For Update View&lt;/strong&gt;:&lt;br /&gt;
&lt;pre&gt;@model ASP.NET_MVC_Application.Models.Client

@{
   &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ViewBag.Title&lt;/span&gt; = &quot;Update the Client&quot;;
   Layout = &quot;~/Views/Shared/_Layout.cshtml&quot;;
}


&amp;lt;div&amp;gt;
  &amp;lt;h3&amp;gt;Update the following form&amp;lt;/h3&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;form method=&quot;post&quot; style=&quot;margin: 5% 0 0&quot;&amp;gt;
  &amp;lt;div class=&quot;float-left&quot;&amp;gt;
     &amp;lt;p&amp;gt;Name&amp;lt;/p&amp;gt;
     &amp;lt;p&amp;gt;Address&amp;lt;/p&amp;gt;
     &amp;lt;p&amp;gt;Trusted&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;
  &amp;lt;div class=&quot;float-right&quot;&amp;gt;
     &amp;lt;input type=&quot;text&quot; style=&quot;margin: 1px 0 2px&quot; name=&quot;name&quot; value=&quot;@&lt;span class=&quot;skimlinks-unlinked&quot;&gt;Model.Name&lt;/span&gt;&quot; /&amp;gt;&amp;lt;br /&amp;gt;
     &amp;lt;input type=&quot;text&quot; style=&quot;margin: 1px 0 2px&quot; name=&quot;address&quot; value=&quot;@Model.Address&quot; /&amp;gt;&amp;lt;br /&amp;gt;
     &amp;lt;input type=&quot;checkbox&quot; style=&quot;margin: 1px 0 2px&quot; name=&quot;trusted&quot; 
          @if (Model.Trusted) { &amp;lt;text&amp;gt;checked=&quot;checked&quot;&amp;lt;/text&amp;gt; } 
     /&amp;gt;
 &amp;lt;br /&amp;gt;
     &amp;lt;input type=&quot;submit&quot; value=&quot;Save&quot; /&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;

&amp;lt;p&amp;gt;
   @if (ViewBag.Submitted != null &amp;amp;&amp;amp; ViewBag.Submitted)
   {
      // If the form was submitted
     @ViewBag.Message
   }
&amp;lt;/p&amp;gt;&lt;/pre&gt;
&lt;strong&gt;For Delete View&lt;/strong&gt;:&lt;br /&gt;
&lt;pre&gt;@{
   Layout = &quot;~/Views/Shared/_Layout.cshtml&quot;;
}

&amp;lt;p&amp;gt;@ViewBag.Message&amp;lt;/p&amp;gt;&lt;/pre&gt;
You will find, that in Create view I am not passing any model. That is because, for a View, to have a model is not obligatory. Model is just to allow dynamic content to it, if you don’t want to use any model, fair enough, you don’t have to use a model in every view to create it an MVC application. These are just simple HTML pages, that are being made update-to-the-content by the razor syntax and then sent back to the browser in an HTML markup, for rendering purposes. _ViewStart.cshtml page is used as the first page to check for any layouts. If you don’t want to set any layout for all of the pages themself and want a unique look across the web app, you can set that in this page and it will be applied to all of the pages.&lt;br /&gt;
&lt;h4&gt;
Creating the custom Model&lt;/h4&gt;
As far as Model is concerned, &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC allows you to use any kind of data (coming from a data source; server or what so ever) to be used as a Model. You can pass the data from the model to the view from the Controller, which will be then rendered as a simple HTML markup and will be displayed inside the browser to the user.&lt;br /&gt;
I have already mentioned, and in-case you missed it above, if you want to use SQL Server database as your Model for application, then &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; team has provided a very good tutorial for that and you might want to join them on their journey &lt;a href=&quot;http://www.asp.net/mvc/overview/getting-started/introduction/adding-a-model&quot;&gt;here&lt;/a&gt;. They used Entity Framework for their Actions. In our project, we will be using JSON files and custom created Actions to perform CRUD operations. This would (try to) remove ambiguity in our minds about this MVC pattern and its extensiveness for other technologies and frameworks.&lt;br /&gt;
A Model, like a Controller, &amp;nbsp;is just a class file, that we can instanitiate and get different objects from, when working with a request from a client. A model is a representation of the real-world objects in our own context; which here is the &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC Application. Think of it like there is a Client model. He would have a ClientID, Name, Address and a Trusted as a flag (you should recall our scenario if you have no idea of where these came from). What would you write as a class for this Client? Look at the following class code and have understanding of the &lt;em&gt;Model&lt;/em&gt; we’re going to have.&lt;br /&gt;
&lt;pre&gt;using System;
using &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.IO&lt;/span&gt;;
using System.Collections.Generic;
using &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.Linq&lt;/span&gt;;
using &lt;span class=&quot;skimlinks-unlinked&quot;&gt;System.Web&lt;/span&gt;;

using &lt;span class=&quot;skimlinks-unlinked&quot;&gt;Newtonsoft.Json&lt;/span&gt;;

namespace ASP.NET_MVC_Application.Models
{
   public class Client
   {
     public static string ClientFile = HttpContext.Current.Server.MapPath(&quot;~/App_Data/&lt;span class=&quot;skimlinks-unlinked&quot;&gt;Clients.json&lt;/span&gt;&quot;);

     public int ID { get; set; }
     public string Name { get; set; }
     public string Address { get; set; }
     public bool Trusted { get; set; }

     public static List&amp;lt;Client&amp;gt; GetClients()
     {
        List&amp;lt;Client&amp;gt; clients = new List&amp;lt;Client&amp;gt;();
        if (File.Exists(ClientFile))
        {
           // File exists..
           string content = File.ReadAllText(ClientFile);
           // Deserialize the objects 
           clients = JsonConvert.DeserializeObject&amp;lt;List&amp;lt;Client&amp;gt;&amp;gt;(content);

           // Returns the clients, either empty list or containing the Client(s).
           return clients;
        }
        else
        {
           // Create the file 
           File.Create(ClientFile).Close();
           // Write data to it; [] means an array, 
           // List&amp;lt;Client&amp;gt; would throw error if [] is not wrapping text
           File.WriteAllText(ClientFile, &quot;[]&quot;);

           // Re run the function
           GetClients();
        }

        return clients;
      }
   }
}&lt;/pre&gt;
A simple C# class file, that would serve our application as a Model. You will find one other major change, which is the namespace this class is location in. The name is having an extra .Models attached to our project’s name. That makes up our different fields. &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; and Visual Studio do these things for us, although they’re not required but just conventions to be followed. Let us create a Model for our application, click on the Models folder in your app, and inside Add click on Class file and name it &lt;span class=&quot;skimlinks-unlinked&quot;&gt;Client.cs&lt;/span&gt; and click Next to continue.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_261&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-174.png&quot;&gt;&lt;img alt=&quot;Select a new class file to be created as a Model&quot; class=&quot;size-medium wp-image-261&quot; height=&quot;115&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-174.png?w=300&amp;amp;h=115&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
Select a new class file to be created as a Model&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_262&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-175.png&quot;&gt;&lt;img alt=&quot;Screenshot (175)&quot; class=&quot;wp-image-262 size-medium&quot; height=&quot;180&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-175.png?w=300&amp;amp;h=180&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
Name it what-ever-you-want, but I would be using Client.&lt;/div&gt;
&lt;/div&gt;
These were the three major fields in the MVC that are used to create an application. However, there are a few other minor fields that work and run our application, that I will be covering here for you to atleast know how to kick-start your project.&lt;br /&gt;
As far, we have covered what is Controller (&lt;em&gt;controls&lt;/em&gt; the HTTP requests coming our going to client), what is a View (it is rendered as HTML output in the browser, the response that is returned to the client in HTML markup can be said to be the View) and finally what is a Model (the representation of the real-world data in our application is called a model). Now, we can go and have a look at the classes and objects which run our application. Like all other apps, that run over .NET framework, &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; also exposes some functions for its developers to use, to perform different actions when the app starts, when the app crashes etc. If you open the folder App_Start in your application, you will find a few classes there. BundleConfig is used to configure your JavaScript libraries, &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; also enables the developers to perform some client-side actions. IdentityConfig configures the Identity service (user authortization servicer), but the main file that I wanted to talk about here, which needs our attention too, is the &lt;span class=&quot;skimlinks-unlinked&quot;&gt;RouteConfig.cs&lt;/span&gt; file.&lt;br /&gt;
In &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt;, you do not need to have a physical path fixed in order for the client to send a request to its virtual location to read it. Instead, you can now create custom URLs to let your users visit your application, without you having to have a specified file at that location. You create different routing techniques, to allow different data values inside the URL to create dynamic web pages for the clients.&lt;br /&gt;
If you open up this file, you will find the following code in it, (I am going to use a partial part of the file)&lt;br /&gt;
&lt;pre&gt;routes.MapRoute(
   name: &quot;Default&quot;,
   url: &quot;{controller}/{action}/{id}&quot;,
   defaults: new { controller = &quot;Home&quot;, action = &quot;Index&quot;, id = UrlParameter.Optional }
);&lt;/pre&gt;
This defines a route, for your application. It has been named “Default” and has the default configurations for the URL, any URL that comes will be matches against this scheme. First value would match for a Controller second to an action (the function inside the Controller class) and then an optional field (see the default values field). You can change this sequence of arragement, to make sure that the URLs are website and user-friendly for your context.&lt;br /&gt;
Every &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; can have as many routes enabled in it, every one will be used but the best possible route would be used, but &lt;em&gt;at least one route&lt;/em&gt; must be present for the app to run. Let us now run the app and test, for anything that might need our attention.&lt;br /&gt;
&lt;h4&gt;
Running the application (Optional part; if you want to download and test the app, skip this section)&lt;/h4&gt;
This application was run over the app named “&lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC Application” but I created a new app named “ASPNET_MVC_Application”, there is a huge different between these two, usually only difference is the namespace naming one so if you were following the blog post you might find this a bit of confusion; so my apologies for that.&lt;img alt=&quot;:)&quot; class=&quot;wp-smiley emoji&quot; draggable=&quot;false&quot; height=&quot;16&quot; src=&quot;https://s1.wp.com/wp-content/mu-plugins/wpcom-smileys/simple-smile.svg&quot; style=&quot;height: 1em; max-height: 1em;&quot; width=&quot;16&quot; /&gt;&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_263&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-146.png&quot;&gt;&lt;img alt=&quot;In the beginning, the table is empty. &quot; class=&quot;size-medium wp-image-263&quot; height=&quot;53&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-146.png?w=300&amp;amp;h=53&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
In the beginning, the table is empty.&lt;/div&gt;
&lt;/div&gt;
Now let us, start adding a few objects; at this instance, let us just take one object under consideration.&lt;br /&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_264&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-147.png&quot;&gt;&lt;img alt=&quot;Fill in this form and click Save, the application would save this client&#39;s information. &quot; class=&quot;size-medium wp-image-264&quot; height=&quot;203&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-147.png?w=300&amp;amp;h=203&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
Fill in this form and click Save, the application would save this client’s information.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;wp-caption alignnone&quot; data-shortcode=&quot;caption&quot; id=&quot;attachment_265&quot; style=&quot;width: 310px;&quot;&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-148.png&quot;&gt;&lt;img alt=&quot;Message showing the success of our operation.&quot; class=&quot;size-medium wp-image-265&quot; height=&quot;163&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-148.png?w=300&amp;amp;h=163&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;div class=&quot;wp-caption-text&quot;&gt;
Message showing the success of our operation.&lt;/div&gt;
&lt;/div&gt;
If you go back to the main page of the Client’s directory (controller), you will find a record available there.&lt;br /&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-149.png&quot;&gt;&lt;img alt=&quot;Screenshot (149)&quot; class=&quot;alignnone size-medium wp-image-266&quot; height=&quot;41&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-149.png?w=300&amp;amp;h=41&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Let us, now try to update this client’s value, in the Actions attribute of table, you will find two hyperlinks, they actually are just Actions (functions) of our controller, we will pass (optional) ID of our client to it, and then we will update the value. We will update our value as,&lt;br /&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-151.png&quot;&gt;&lt;img alt=&quot;Screenshot (151)&quot; class=&quot;alignnone size-medium wp-image-267&quot; height=&quot;178&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-151.png?w=300&amp;amp;h=178&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Let’s go back and see if our View now reflects any change.&lt;br /&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-152.png&quot;&gt;&lt;img alt=&quot;Screenshot (152)&quot; class=&quot;alignnone size-medium wp-image-268&quot; height=&quot;59&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-152.png?w=300&amp;amp;h=59&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
Voila! It does reflect our change, which proves that a Model updates the View for any new change that we make. Try using the second hyperlink, it would delete the object from the collection.&lt;br /&gt;
&lt;a href=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-153.png&quot;&gt;&lt;img alt=&quot;Screenshot (153)&quot; class=&quot;alignnone size-medium wp-image-269&quot; height=&quot;86&quot; src=&quot;https://basicsofwebdevelopment.files.wordpress.com/2015/01/screenshot-153.png?w=300&amp;amp;h=86&quot; width=&quot;300&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
That was up, for the working process. Now our application runs fine enough, our manager can add clients, remove clients or modify their data as per his requirements. As far as now, this application is running and our clients can visit and use it as per their requirement.&lt;br /&gt;
This was a basic overview of &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC application, that contains the Model for our data, View for the users to visit and see and a Controller that controls the HTTP data coming or going to the client.&lt;br /&gt;
&lt;h2&gt;
Points of Interest&lt;/h2&gt;
&lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC pattern contains a Controller for controlling all of the HTTP requests coming, and responses going to the clients. A view for generating HTML web pages, Razor view engine is used for creating the HTML markup from C# objects. A Model is a simple C# class that contains the object’s properties. Each time the application is run, Controller gets the data from the Model and populates the View for the user to read the result in his/her browser.&lt;br /&gt;
Every real-world object can be used in &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; MVC application as the data source. To create a model, C# files are used (if you’re using C#, otherwise you would be creating a file related to your language). The properties and members act as properties that you would be using inside your HTML markup for rendering purposes.&lt;br /&gt;
You can control what kind of URLs are being used in your application by creating routing techniques. These define the structure of your application’s URLs. You must define at least one route in your application for it to run, otherwise you can define as many as you want.&lt;br /&gt;
MVC pattern removes the ambiguity between the data and the code-behind of your application. Your code-behind is now a part of the Controller of your application and is written inside the Controllers. The data is stored inside the Model (actually which is just the representation of the data, actual data is stored in somewhere like a file or database) and the what user sees is written in the View. This way, any error can be fixed as soon as possible without having to worry about any other bug, because every field is now controlled and written in a different part.&lt;br /&gt;
Model part of this pattern must always not perform any kind of business-logic, because that would entirely kill the actual purpose of this MVC pattern. That is why, all of the logic code is written in the controller; even the creation of data or the manipulation of data should be done in controller through functions, since user has no connection with Model, it provides an extra layer of safety as the user is totally oblivious to the schema of the database.&lt;br /&gt;
ViewBag and the View are special objects in &lt;span class=&quot;skimlinks-unlinked&quot;&gt;ASP.NET&lt;/span&gt; used to manipulate the View (HTML markup), you can pass any member (which is dynamic) to this ViewBag from the Controller, to be used inside the View page (.cshtml in these cases) for rendering; like I did for showing some messages like an error or a success message&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
from &amp;nbsp;&lt;a href=&quot;https://basicsofwebdevelopment.wordpress.com/2015/01/31/understanding-asp-net-mvc-using-real-world-example-for-beginners-and-intermediate/&quot; target=&quot;_blank&quot;&gt;Copy here&amp;nbsp;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/2174125341758225623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2016/08/understanding-aspnet-mvc-using-real.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/2174125341758225623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/2174125341758225623'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2016/08/understanding-aspnet-mvc-using-real.html' title='Understanding ASP.NET MVC using real world example, for beginners and intermediate'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-3352717065221956848</id><published>2015-04-30T00:09:00.002-07:00</published><updated>2015-04-30T00:09:33.756-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><title type='text'>(nested gridview):How to Get parent gridview rowindex on a child gridview link button click</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp;GridViewRow Gv2Row = (GridViewRow)((LinkButton)sender).NamingContainer;
        GridView Childgrid = (GridView)(Gv2Row.Parent.Parent);
        GridViewRow Gv1Row = (GridViewRow)(Childgrid.NamingContainer);
        int b = Gv1Row.RowIndex;
&lt;pre id=&quot;pre851438&quot; lang=&quot;c#&quot; style=&quot;background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, &#39;Courier New&#39;, Courier, mono; font-size: 9pt; font-stretch: normal; overflow: auto !important; padding: 6px; tab-size: 4; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;/pre&gt;
&lt;pre id=&quot;pre851438&quot; lang=&quot;c#&quot; style=&quot;background-color: #fbedbb; border: 1px solid rgb(251, 237, 187); font-family: Consolas, &#39;Courier New&#39;, Courier, mono; font-size: 9pt; font-stretch: normal; overflow: auto !important; padding: 6px; tab-size: 4; white-space: pre-wrap; word-wrap: break-word;&quot;&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/3352717065221956848/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2015/04/nested-gridviewhow-to-get-parent.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/3352717065221956848'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/3352717065221956848'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2015/04/nested-gridviewhow-to-get-parent.html' title='(nested gridview):How to Get parent gridview rowindex on a child gridview link button click'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-7563420906876631298</id><published>2015-04-08T22:20:00.003-07:00</published><updated>2015-04-08T22:20:24.726-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><title type='text'>how to get list of tables, functions and  stored procedure created last month in sql server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
SELECT&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [name]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;,create_date&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;,modify_date&lt;br /&gt;
FROM&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sys.tables where create_date &amp;gt;=&#39;03/01/2015&#39;&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; SELECT * FROM sys.procedures WHERE &amp;nbsp;create_date &amp;gt;=&#39;03/01/2015&#39;&lt;br /&gt;
&lt;br /&gt;
SELECT *&lt;br /&gt;
FROM sys.objects&lt;br /&gt;
WHERE type IN (&#39;FN&#39;, &#39;IF&#39;, &#39;TF&#39;) &amp;nbsp;-- scalar, inline table-valued, table-valued&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/7563420906876631298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2015/04/how-to-get-list-of-tables-functions-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/7563420906876631298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/7563420906876631298'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2015/04/how-to-get-list-of-tables-functions-and.html' title='how to get list of tables, functions and  stored procedure created last month in sql server'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-5708568791183891889</id><published>2015-02-05T22:10:00.002-08:00</published><updated>2015-02-05T22:10:34.514-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><title type='text'>how to get files from google drive </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;lt;head runat=&quot;server&quot;&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;Google drive attachment Example&amp;lt;/title&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script type=&quot;text/javascript&quot; src=&quot;https://apis.google.com/js/api.js?onload=onApiLoad&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function onApiLoad() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gapi.load(&#39;auth&#39;, { &#39;callback&#39;: onAuthApiLoad });&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; gapi.load(&#39;picker&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function onAuthApiLoad() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; window.gapi.auth.authorize({&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;client_id&#39;: &#39;376407259412-3m7pu8htrdvf2u2tt9flm9o8pftioqj6.apps.googleusercontent.com&#39;,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;scope&#39;: [&#39;https://www.googleapis.com/auth/drive&#39;]&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }, handleAuthResult);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var oauthToken;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function handleAuthResult(authResult) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (authResult &amp;amp;&amp;amp; !authResult.error) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; oauthToken = authResult.access_token;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; createPicker();&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;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function createPicker() {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var picker = new google.picker.PickerBuilder()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //.addView(new google.picker.DocsUploadView())&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .addView(new google.picker.DocsView())&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .setOAuthToken(oauthToken)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //.setDeveloperKey(&#39;AIzaSyDPs9U-dgOC9h1jRFNwOwhRtARCph8_3HM&#39;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .setCallback(pickerCallback)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; .build();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; picker.setVisible(true);&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; function pickerCallback(data) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var url = &#39;nothing&#39;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (data[google.picker.Response.ACTION] == google.picker.Action.PICKED) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var doc = data[google.picker.Response.DOCUMENTS][0];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; url = doc[google.picker.Document.URL];&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; var message = &#39;You picked: &#39; + url;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; document.getElementById(&#39;result&#39;).innerHTML = message;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/head&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;asp:Button ID=&quot;btnupload&quot; runat=&quot;server&quot; Text=&quot;Google Drive&quot; OnClick=&quot;btnupload_Click&quot; /&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;div id=&quot;result&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;%--&amp;lt;script type=&quot;text/javascript&quot; src=&quot;https://apis.google.com/js/api.js?onload=onApiLoad&quot;&amp;gt;&amp;lt;/script&amp;gt;--%&amp;gt;&lt;br /&gt;
&amp;lt;/form&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in the code behind on button click&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;protected void btnupload_Click(object sender, EventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Page.ClientScript.RegisterStartupScript(this.GetType(), &quot;https://apis.google.com/js/api.js?onload&quot;, &quot;onApiLoad();&quot;, true);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/5708568791183891889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2015/02/how-to-get-files-from-google-drive.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/5708568791183891889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/5708568791183891889'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2015/02/how-to-get-files-from-google-drive.html' title='how to get files from google drive '/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-7088396553152195902</id><published>2014-11-17T02:09:00.001-08:00</published><updated>2014-11-17T02:09:15.965-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Samsung Omnia w"/><title type='text'>Error 80043004 solved in windows phone</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hello Guys,&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;from last month i was suffering with this error. but today i have solved this error.&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;month ago i changed my hotmail id password. so i was getting this error.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;for solve this go to in your xbolx live. and here login again with your new password &amp;nbsp;and the problem will solve.&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/7088396553152195902/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2014/11/error-80043004-solved-in-windows-phone.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/7088396553152195902'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/7088396553152195902'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2014/11/error-80043004-solved-in-windows-phone.html' title='Error 80043004 solved in windows phone'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-6925143729359176682</id><published>2014-09-22T04:51:00.000-07:00</published><updated>2014-09-22T04:51:03.049-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><title type='text'>Using comma separated value parameter strings in SQL IN clauses</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
SET ANSI_NULLS ON&lt;br /&gt;
GO&lt;br /&gt;
&lt;br /&gt;
SET QUOTED_IDENTIFIER ON&lt;br /&gt;
GO&lt;br /&gt;
&lt;br /&gt;
CREATE FUNCTION [dbo].[CSVToTable] (@InStr VARCHAR(MAX))&lt;br /&gt;
RETURNS @TempTab TABLE&lt;br /&gt;
&amp;nbsp; &amp;nbsp;(id int not null)&lt;br /&gt;
AS&lt;br /&gt;
BEGIN&lt;br /&gt;
&amp;nbsp; &amp;nbsp; ;-- Ensure input ends with comma&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;SET @InStr = REPLACE(@InStr + &#39;,&#39;, &#39;,,&#39;, &#39;,&#39;)&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;DECLARE @SP INT&lt;br /&gt;
DECLARE @VALUE VARCHAR(1000)&lt;br /&gt;
WHILE PATINDEX(&#39;%,%&#39;, @INSTR ) &amp;lt;&amp;gt; 0&lt;br /&gt;
BEGIN&lt;br /&gt;
&amp;nbsp; &amp;nbsp;SELECT &amp;nbsp;@SP = PATINDEX(&#39;%,%&#39;,@INSTR)&lt;br /&gt;
&amp;nbsp; &amp;nbsp;SELECT &amp;nbsp;@VALUE = LEFT(@INSTR , @SP - 1)&lt;br /&gt;
&amp;nbsp; &amp;nbsp;SELECT &amp;nbsp;@INSTR = STUFF(@INSTR, 1, @SP, &#39;&#39;)&lt;br /&gt;
&amp;nbsp; &amp;nbsp;INSERT INTO @TempTab(id) VALUES (@VALUE)&lt;br /&gt;
END&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;RETURN&lt;br /&gt;
END&lt;br /&gt;
GO&lt;br /&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;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; color: #111111; font-family: &#39;Segoe UI&#39;, Arial, sans-serif; font-size: 14px;&quot;&gt;This creates a user function that takes a comma separated value string and converts it into a table that SQL does understand - just pass it the sting, and it works it all out. It&#39;s pretty obvious how it works, the only complexity is the REPLACE part which ensures the string is terminated with a single comma by appending one, and removing all double commas from the string. Without this, while loop becomes harder to process, as the final number might or might not have a terminating comma and that would have to be dealt with separately.&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; color: #111111; font-family: &#39;Segoe UI&#39;, Arial, sans-serif; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; color: #111111; font-family: &#39;Segoe UI&#39;, Arial, sans-serif; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white; color: #111111; font-family: &#39;Segoe UI&#39;, Arial, sans-serif; font-size: 14px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: #111111; font-family: Segoe UI, Arial, sans-serif;&quot;&gt;&lt;div style=&quot;font-size: 14px;&quot;&gt;
DECLARE @LIST VARCHAR(200)&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
SET @LIST = &#39;1,3&#39;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
SELECT Id, Descr FROM CSVDemo WHERE Id IN (SELECT * FROM dbo.CSVToTable(@LIST))&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-size: 14px;&quot;&gt;&lt;a href=&quot;http://www.codeproject.com/Tips/584680/Using-comma-separated-value-parameter-strings-in-S&quot;&gt;http://www.codeproject.com/Tips/584680/Using-comma-separated-value-parameter-strings-in-S&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/6925143729359176682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2014/09/using-comma-separated-value-parameter_22.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/6925143729359176682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/6925143729359176682'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2014/09/using-comma-separated-value-parameter_22.html' title='Using comma separated value parameter strings in SQL IN clauses'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-711019076325459618</id><published>2014-09-08T00:35:00.001-07:00</published><updated>2014-09-08T00:35:30.280-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Extra blogs"/><title type='text'>some comman shortcuts</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; style=&quot;background: rgb(255, 255, 255); border-collapse: collapse; border-spacing: 0px; border: 1px solid rgb(231, 231, 231); color: #888888; font-family: &#39;Open Sans&#39;, Arial, Georgia, &#39;Bitstream Charter&#39;, serif; font-size: 12px; line-height: 15.6000003814697px; margin: 0px -1px 24px 0px; padding: 0px; vertical-align: baseline; width: 689px;&quot;&gt;&lt;tbody style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;F1&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Display Help&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+C&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Copy the selected item&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+X&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Cut the selected item&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+V&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Paste the selected item&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+Z&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Undo an action&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+Y&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Redo an action&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Delete&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Delete the selected item and move it to the Recycle Bin&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Shift+Delete&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Delete the selected item without moving it to the Recycle Bin first&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;F2&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Rename the selected item&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+Right Arrow&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Move the cursor to the beginning of the next word&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+Left Arrow&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Move the cursor to the beginning of the previous word&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+Down Arrow&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Move the cursor to the beginning of the next paragraph&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+Up Arrow&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Move the cursor to the beginning of the previous paragraph&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+Shift with an arrow key&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Select a block of text&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Shift with any arrow key&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Select more than one item in a window or on the desktop, or select text within a document&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl with any arrow key+Spacebar&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Select multiple individual items in a window or on the desktop&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+A&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Select all items in a document or window&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;F3&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Search for a file or folder&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Alt+Enter&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Display properties for the selected item&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Alt+F4&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Close the active item, or exit the active program&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Alt+Spacebar&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Open the shortcut menu for the active window&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+F4&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Close the active document (in programs that allow you to have multiple documents open simultaneously)&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Alt+Tab&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Switch between open items&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+Alt+Tab&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Use the arrow keys to switch between open items&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+Mouse scroll wheel&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Change the size of icons on the desktop&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Windows logo key +Tab&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Cycle through programs on the taskbar by using Aero Flip 3-D&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+Windows logo key+Tab&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Use the arrow keys to cycle through programs on the taskbar by using Aero Flip 3-D&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Alt+Esc&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Cycle through items in the order in which they were opened&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;F6&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Cycle through screen elements in a window or on the desktop&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;F4&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Display the address bar list in Windows Explorer&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Shift+F10&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Display the shortcut menu for the selected item&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+Esc&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Open the Start menu&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Alt+underlined letter&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Display the corresponding menu&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Alt+underlined letter&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Perform the menu command (or other underlined command)&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;F10&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Activate the menu bar in the active program&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Right Arrow&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Open the next menu to the right, or open a submenu&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Left Arrow&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Open the next menu to the left, or close a submenu&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;F5&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Refresh the active window&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Alt+Up Arrow&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;View the folder one level up in Windows Explorer&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Esc&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Cancel the current task&lt;/td&gt;&lt;/tr&gt;
&lt;tr class=&quot;odd&quot; style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Ctrl+Shift+Esc&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: rgb(241, 241, 241); border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Open Task Manager&lt;/td&gt;&lt;/tr&gt;
&lt;tr style=&quot;background: transparent; border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;&lt;strong style=&quot;background: transparent; border: 0px; color: #444444; margin: 0px; padding: 0px; vertical-align: baseline;&quot;&gt;Shift when you insert a CD&lt;/strong&gt;&lt;/td&gt;&lt;td style=&quot;background: transparent; border-top-color: rgb(231, 231, 231); border-top-style: solid; border-width: 1px 0px 0px; margin: 0px; padding: 4px 8px; vertical-align: baseline;&quot;&gt;Prevent the CD from automatically playing&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/711019076325459618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2014/09/some-comman-shortcuts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/711019076325459618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/711019076325459618'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2014/09/some-comman-shortcuts.html' title='some comman shortcuts'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-1390916440036103570</id><published>2014-08-28T23:47:00.003-07:00</published><updated>2014-08-28T23:48:06.457-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><title type='text'>nested girdview in datalist cancel update delete c#</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp; &amp;lt;asp:DataList ID=&quot;datalist1&quot; Width=&quot;100%&quot; DataKeyField=&quot;level2taskno&quot; runat=&quot;server&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; &amp;nbsp; &amp;nbsp; &amp;nbsp; OnItemDataBound=&quot;datalist_ItemDataBound&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;nbsp; &amp;nbsp; &amp;lt;HeaderStyle HorizontalAlign=&quot;Center&quot;&amp;gt;&amp;lt;/HeaderStyle&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;ItemTemplate&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;table style=&quot;width: 100%; color: Black; font-family: Arial; font-size: 12px;&quot; cellspacing=&quot;0&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;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;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;td&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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;table style=&quot;width: 100%; color: Black; font-family: Arial; font-size: 12px; border: 1px solid #9a9a9a;&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; &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; cellpadding=&quot;5&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;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;tr&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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td bgcolor=&quot;#8ce8a0&quot; valign=&quot;top&quot; width=&quot;7%&quot; style=&quot;color: #fff; font-size: 12px;&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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; font-weight: bold;&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;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;b&amp;gt;Initiative(s):&amp;lt;/b&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;nbsp; &amp;nbsp; &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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td style=&quot;font-family: Arial; font-size: 18px;&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;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;b&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;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;asp:Label ID=&quot;lbltask&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Eval(&quot;TaskName&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/asp:Label&amp;gt;&amp;lt;/b&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;nbsp; &amp;nbsp; &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;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;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;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;tr&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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td bgcolor=&quot;#9bc1d4&quot; valign=&quot;top&quot; style=&quot;color: #fff; font-size: 12px; font-weight: bold;&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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; padding-top: 10px;&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;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;b&amp;gt;Outcome(s):&amp;lt;/b&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;nbsp; &amp;nbsp; &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;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;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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Literal runat=&quot;server&quot; ID=&quot;outcome&quot; Text=&#39;&amp;lt;%# string.Join(&quot;&amp;lt;p style=margin-left:0px; &amp;gt;&quot;, Eval(&quot;outcome&quot;).ToString().Split(new []{(char)13},StringSplitOptions.None)) %&amp;gt;&#39;&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;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:Literal&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;nbsp; &amp;nbsp; &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;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;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;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;tr&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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td bgcolor=&quot;#e8b880&quot; valign=&quot;top&quot; style=&quot;color: #fff; font-size: 12px; font-weight: bold;&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;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;b&amp;gt;Indicators:&amp;lt;/b&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;nbsp; &amp;nbsp; &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;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;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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Literal runat=&quot;server&quot; ID=&quot;Literal1&quot; Text=&#39;&amp;lt;%# string.Join(&quot;&amp;lt;p style=margin-left:0px;&amp;gt; &amp;nbsp;&quot;, Eval(&quot;indicators&quot;).ToString().Split(new []{(char)13},StringSplitOptions.None)) %&amp;gt;&#39;&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;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:Literal&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;nbsp; &amp;nbsp; &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;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;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;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;tr&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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td bgcolor=&quot;#a6988f&quot; width=&quot;7%&quot; valign=&quot;top&quot; style=&quot;color: #fff; font-size: 12px;&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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; font-weight: bold;&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;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;b&amp;gt;Activities: &amp;lt;/b&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;nbsp; &amp;nbsp; &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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;td width=&quot;100%&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;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;div style=&quot;width: 100%;&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;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;nbsp; &amp;nbsp; &amp;lt;asp:GridView ID=&quot;GridViewlist&quot; DataKeyNames=&quot;level2tasklink,level3taskno&quot; runat=&quot;server&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; &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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ShowHeader=&quot;true&quot; Width=&quot;100%&quot; BorderColor=&quot;#e2e2e2&quot; AutoGenerateColumns=&quot;false&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; &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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; OnRowCancelingEdit=&quot;GridView2_RowCancelingEdit&quot; OnRowDeleting=&quot;GridView2_RowDeleting&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; &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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; OnRowEditing=&quot;GridView2_RowEditing&quot; OnRowUpdating=&quot;GridView2_RowUpdating&quot; OnRowDataBound=&quot;grdQuater1_RowDataBound&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;RowStyle VerticalAlign=&quot;Middle&quot; HorizontalAlign=&quot;Center&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;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;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;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;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:TemplateField HeaderText=&quot;No.&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:HiddenField ID=&quot;hidCusState&quot; runat=&quot;server&quot; Value=&#39;&amp;lt;%# Bind(&quot;level3taskno&quot;) %&amp;gt;&#39; /&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Label ID=&quot;lblautoid&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Container.DataItemIndex+1 &amp;nbsp;%&amp;gt;&#39;&amp;gt;&amp;lt;/asp:Label&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;lt;/asp:TemplateField&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;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;nbsp; &amp;nbsp; &amp;lt;asp:TemplateField HeaderText=&quot;Activity&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Label ID=&quot;lblactivity&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Eval(&quot;Activitydescnational&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/asp:Label&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemStyle Width=&quot;30%&quot; VerticalAlign=&quot;Middle&quot; HorizontalAlign=&quot;Left&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;EditItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:TextBox Style=&quot;width: 100%;&quot; ID=&quot;txtactivity&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Bind(&quot;Activitydescnational&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/asp:TextBox&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/EditItemTemplate&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;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;nbsp; &amp;nbsp; &amp;lt;/asp:TemplateField&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;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;nbsp; &amp;nbsp; &amp;lt;asp:TemplateField HeaderText=&quot;Outputs&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Label ID=&quot;lbloutput&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Eval(&quot;output&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/asp:Label&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemStyle Width=&quot;30%&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;EditItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:TextBox Style=&quot;width: 100%;&quot; ID=&quot;txtoutput&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Bind(&quot;output&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/asp:TextBox&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/EditItemTemplate&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;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;nbsp; &amp;nbsp; &amp;lt;/asp:TemplateField&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;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;nbsp; &amp;nbsp; &amp;lt;asp:TemplateField HeaderText=&quot;Global / National&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Label ID=&quot;lblglobal&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Eval(&quot;global1&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/asp:Label&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemStyle Width=&quot;10%&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;EditItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:TextBox ID=&quot;txtglobal&quot; Style=&#39;text-transform: uppercase;&#39; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Bind(&quot;global1&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/asp:TextBox&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/EditItemTemplate&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;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;nbsp; &amp;nbsp; &amp;lt;/asp:TemplateField&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;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;nbsp; &amp;nbsp; &amp;lt;asp:TemplateField HeaderText=&quot;Activity Type&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Label ID=&quot;lblactivitytype&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Eval(&quot;mov1&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/asp:Label&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemStyle Width=&quot;10%&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;EditItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:DropDownList ID=&quot;drpmov&quot; AutoPostBack=&quot;true&quot; runat=&quot;server&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;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;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;&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/EditItemTemplate&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;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;nbsp; &amp;nbsp; &amp;lt;/asp:TemplateField&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;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;nbsp; &amp;nbsp; &amp;lt;asp:TemplateField HeaderText=&quot;Deadline&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Label ID=&quot;lblmonth&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Eval(&quot;month_due1&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/asp:Label&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemStyle Width=&quot;10%&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;EditItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:DropDownList ID=&quot;drpdeadline&quot; AutoPostBack=&quot;true&quot; runat=&quot;server&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;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;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;&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/EditItemTemplate&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;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;nbsp; &amp;nbsp; &amp;lt;/asp:TemplateField&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;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;nbsp; &amp;nbsp; &amp;lt;asp:TemplateField HeaderText=&quot;Status&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Image ID=&quot;done&quot; runat=&quot;server&quot; Width=&quot;25&quot; Height=&quot;25&quot; ImageUrl=&#39;&amp;lt;%# &quot;~/Images/&quot; + (((bool)Eval(&quot;status&quot;) == false) ? &quot;NotDone.jpg&quot; : &quot;Done.jpg&quot;) %&amp;gt;&#39;&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/asp:Image&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;%-- &amp;lt;asp:Image ID=&quot;notdone&quot; runat=&quot;server&quot; Width=&quot;25&quot; Height=&quot;25&quot; Visible=&quot;false&quot; ImageUrl=&quot;~/images/NotDone.jpg&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/asp:Image&amp;gt;--%&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemStyle Width=&quot;5%&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/asp:TemplateField&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;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;nbsp; &amp;nbsp; &amp;lt;asp:TemplateField HeaderText=&quot;User&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;asp:Label ID=&quot;lbluser&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Eval(&quot;level3name&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/asp:Label&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemStyle Width=&quot;10%&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/asp:TemplateField&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;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;nbsp; &amp;nbsp; &amp;lt;%-- &amp;lt;asp:TemplateField HeaderText=&quot;File Reports&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;ItemTemplate&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;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;nbsp; &amp;nbsp; &amp;lt;asp:LinkButton CommandName=&#39;&amp;lt;%# Eval(&quot;mov1&quot;) %&amp;gt;&#39; ID=&quot;lnkreport&quot; ForeColor=&quot;#2aa9df&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; &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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CommandArgument=&#39;&amp;lt;%# Eval(&quot;level3taskno&quot;) %&amp;gt;&#39; OnClick=&quot;LinkButton1_Click&quot; runat=&quot;server&quot;&amp;gt;File Report&amp;lt;/asp:LinkButton&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;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;/ItemTemplate&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;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;ItemStyle Width=&quot;8%&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;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;nbsp; &amp;nbsp; &amp;lt;/asp:TemplateField&amp;gt;--%&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;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;nbsp; &amp;nbsp; &amp;lt;asp:CommandField HeaderText=&quot;Edit&quot; &amp;nbsp;ShowEditButton=&quot;True&quot;&amp;gt;&amp;lt;/asp:CommandField&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;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;nbsp; &amp;nbsp; &amp;lt;asp:CommandField HeaderText=&quot;Delete&quot; &amp;nbsp;ShowDeleteButton=&quot;True&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/asp:CommandField&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;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;/Columns&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;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;FooterStyle BackColor=&quot;#6e6e6e&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;PagerStyle ForeColor=&quot;White&quot; VerticalAlign=&quot;Middle&quot; HorizontalAlign=&quot;Center&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;SelectedRowStyle HorizontalAlign=&quot;Center&quot; Font-Bold=&quot;True&quot; ForeColor=&quot;#333333&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;HeaderStyle BackColor=&quot;#6e6e6e&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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;EditRowStyle /&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;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;AlternatingRowStyle HorizontalAlign=&quot;Center&quot; BackColor=&quot;White&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;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;nbsp; &amp;nbsp; &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;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;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &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;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;/td&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;nbsp; &amp;nbsp; &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;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;/table&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;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;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;/tr&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;/table&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;/ItemTemplate&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:DataList&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
first bind the datalist according to your records&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;void datalist()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sql = &quot;select * from tbl_Task_Objective where level2TaskNo in(select distinct level2TaskLink from tbl_Individual_Task where &amp;nbsp;level3name=&#39;&quot; + Request.QueryString[&quot;id&quot;].ToString() + &quot;&#39;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (drpquarter.SelectedItem.Text != &quot;All&quot;)&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; sql = sql + &quot; and &amp;nbsp;quarter=&#39;&quot; + drpquarter.SelectedItem.Value + &quot;&#39; &quot;;&lt;br /&gt;
&lt;br /&gt;
&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; if (drpinitiative.SelectedItem.Text != &quot;All&quot;)&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; sql = sql + &quot; and level2tasklink=&#39;&quot; + drpinitiative.SelectedItem.Value + &quot;&#39;&quot;;&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; sql = sql + &quot;)&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds = SqlHelper.ExecuteDataset(Cnn, CommandType.Text, sql);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; datalist1.DataSource = ds.Tables[0];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; datalist1.DataBind();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
2. then &amp;nbsp;itemdataboud of datalist&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;protected void datalist_ItemDataBound(object sender, DataListItemEventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)&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; string id = (datalist1.DataKeys[e.Item.ItemIndex]).ToString();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView gv = (GridView)e.Item.FindControl(&quot;GridViewlist&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label lb1 = (Label)e.Item.FindControl(&quot;lbltask&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label lblmonth = (Label)e.Item.FindControl(&quot;lblmonth&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bindgrid(gv, id);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
3. using bindgrid function&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;private void bindgrid(GridView GridView, string id)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sql = &quot;select *, dbo.GetMonthName(month_due) as month_due1 ,dbo.GetDoneStaus(level3TaskNo) Status1,dbo.GetGlobal(global)as global1,dbo.getmov1(mov)as mov1 from tbl_Individual_Task where &amp;nbsp;level2tasklink=&#39;&quot; + id + &quot;&#39; and level3name=&#39;&quot; + Request.QueryString[&quot;id&quot;].ToString() + &quot;&#39; &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (drpquarter.SelectedItem.Text != &quot;All&quot;)&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; sql = sql + &quot; and quarter=&#39;&quot; + drpquarter.SelectedItem.Value + &quot;&#39; &amp;nbsp;&quot;;&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; if (drpinitiative.SelectedItem.Text != &quot;All&quot;)&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; sql = sql + &quot; and level2tasklink=&#39;&quot; + drpinitiative.SelectedItem.Value + &quot;&#39;&quot;;&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; if (drpglobal.SelectedItem.Text != &quot;All&quot;)&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; sql = sql + &quot; and global=&#39;&quot; + drpglobal.SelectedItem.Value + &quot;&#39;&quot;;&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; ds1 = SqlHelper.ExecuteDataset(Cnn, CommandType.Text, sql);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ds1.Tables[0].Rows.Count &amp;gt; 0)&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; GridView.DataSource = ds1.Tables[0];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView.DataBind();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
4.gridview rowdatabound event accroding to your requirements&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; protected void grdQuater1_RowDataBound(object sender, GridViewRowEventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (e.Row.RowType == DataControlRowType.DataRow)&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; string item = e.Row.Cells[1].Text;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (e.Row.Cells[9].HasControls())&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; LinkButton lnkbtnDelete = ((LinkButton)e.Row.Cells[9].Controls[0]);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lnkbtnDelete.Attributes.Add(&quot;onclick&quot;, &quot;return confirm(&#39;Do you want to Delete&quot; + item + &quot;?&#39;);&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;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (e.Row.RowType == DataControlRowType.DataRow &amp;amp;&amp;amp; (e.Row.RowState &amp;amp; DataControlRowState.Edit) &amp;gt; 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; //string id = (datalist1.DataKeys[e.Row.RowIndex]).ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // object objTemp = GridViewlist.DataKeys[e.Row.RowIndex].Value as object;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView gv = (GridView)e.Row.FindControl(&quot;GridView2&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label lb = (Label)e.Row.FindControl(&quot;lblno&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label lb1 = (Label)e.Row.FindControl(&quot;lbltask&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Image img = (Image)e.Row.FindControl(&quot;done&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Image img1 = (Image)e.Row.FindControl(&quot;notdone&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label lblmonth = (Label)e.Row.FindControl(&quot;lblmonth&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Label lbluser = (Label)e.Row.FindControl(&quot;lbluser&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; HiddenField hidCusState = (HiddenField)e.Row.FindControl(&quot;hidCusState&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string level3taskno = hidCusState.Value;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //LinkButton lnk = (LinkButton)e.Row.FindControl(&quot;lnkreport&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //string idd = lnk.CommandArgument;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //sql = &quot;select *, dbo.GetMonthName(month_due) as month_due1 ,dbo.GetDoneStaus(level3TaskNo) Status1,dbo.GetGlobal(global)as global1 from tbl_Individual_Task where quarter=1 and level2tasklink=&#39;&quot; + id + &quot;&#39; and &amp;nbsp;level3name=&#39;&quot; + Session[&quot;Name&quot;].ToString() + &quot;&#39;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //ds1 = SqlHelper.ExecuteDataset(Cnn, CommandType.Text, sql);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sql = &quot;select *, dbo.GetMonthName(month_due) as month_due1 ,dbo.GetDoneStaus(level3TaskNo) Status1,dbo.GetGlobal(global)as global1,dbo.getmov1(mov)as mov1 from tbl_Individual_Task where &amp;nbsp;level3taskno=&#39;&quot; + level3taskno + &quot;&#39; &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (drpquarter.SelectedItem.Text != &quot;All&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; &amp;nbsp; &amp;nbsp; sql = sql + &quot; and quarter=&#39;&quot; + drpquarter.SelectedItem.Value + &quot;&#39; &amp;nbsp;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &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; if (drpinitiative.SelectedItem.Text != &quot;All&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; &amp;nbsp; &amp;nbsp; sql = sql + &quot; and level2tasklink=&#39;&quot; + drpinitiative.SelectedItem.Value + &quot;&#39;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &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; &amp;nbsp; &amp;nbsp; if (drpglobal.SelectedItem.Text != &quot;All&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; &amp;nbsp; &amp;nbsp; sql = sql + &quot; and global=&#39;&quot; + drpglobal.SelectedItem.Value + &quot;&#39;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds1 = SqlHelper.ExecuteDataset(Cnn, CommandType.Text, sql);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ds1.Tables[0].Rows.Count &amp;gt; 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; if (ds1.Tables[0].Rows[0][&quot;status1&quot;].ToString() == &quot;Done&quot;)&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; //img.Visible = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //img1.Visible = false;&lt;br /&gt;
&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; else&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; //img.Visible = false;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //img1.Visible = true;&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; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DropDownList drpdeadline = (DropDownList)e.Row.FindControl(&quot;drpdeadline&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sql = &quot;select Monthno,MonthName from tbl_Month_Master order by Monthno &amp;nbsp;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds = SqlHelper.ExecuteDataset(Cnn, CommandType.Text, sql);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ds.Tables[0].Rows.Count &amp;gt; 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; drpdeadline.DataSource = ds.Tables[0];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpdeadline.DataTextField = &quot;MonthName&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpdeadline.DataValueField = &quot;Monthno&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpdeadline.DataBind();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpdeadline.SelectedItem.Text = ds1.Tables[0].Rows[0][&quot;month_due1&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // drpdeadline.Items.Insert(0, new ListItem(&quot;--Select--&quot;, &quot;0&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; DropDownList drpmov = (DropDownList)e.Row.FindControl(&quot;drpmov&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sql = &quot;select * from tbl_verification_master&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds = SqlHelper.ExecuteDataset(Cnn, CommandType.Text, sql);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ds.Tables[0].Rows.Count &amp;gt; 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; drpmov.DataSource = ds.Tables[0];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpmov.DataTextField = &quot;description&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpmov.DataValueField = &quot;id&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpmov.DataBind();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpmov.SelectedItem.Text = ds1.Tables[0].Rows[0][&quot;mov1&quot;].ToString();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // drpmov.Items.Insert(0, new ListItem(&quot;--Select--&quot;, &quot;0&quot;));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&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;br /&gt;
5. then using row deleteing updating&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;protected void GridView2_RowEditing(object sender, GridViewEditEventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView GridView1 = (GridView)sender;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView1.EditIndex = e.NewEditIndex;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bindgrid(GridView1, GridView1.DataKeys[e.NewEditIndex][0].ToString());&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected void GridView2_RowUpdating(object sender, GridViewUpdateEventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView GridView1 = (GridView)sender;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox txtactivity = (TextBox)GridView1.Rows[e.RowIndex].FindControl(&quot;txtactivity&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox txtoutput = (TextBox)GridView1.Rows[e.RowIndex].FindControl(&quot;txtoutput&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TextBox txtglobal = (TextBox)GridView1.Rows[e.RowIndex].FindControl(&quot;txtglobal&quot;);//.Cells[1].Controls[0];&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DropDownList drpdeadline = (DropDownList)GridView1.Rows[e.RowIndex].FindControl(&quot;drpdeadline&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DropDownList drpmov = (DropDownList)GridView1.Rows[e.RowIndex].FindControl(&quot;drpmov&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sql = &quot;select Monthno,MonthName from tbl_Month_Master where monthname=&#39;&quot; + drpdeadline.SelectedItem.Text + &quot;&#39; &quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds = SqlHelper.ExecuteDataset(Cnn, CommandType.Text, sql);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ds.Tables[0].Rows.Count &amp;gt; 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; drpdeadline.DataSource = ds.Tables[0];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpdeadline.DataTextField = &quot;MonthName&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpdeadline.DataValueField = &quot;Monthno&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpdeadline.DataBind();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string drp = drpdeadline.SelectedItem.Text;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string drpdeadlinevalue = drpdeadline.SelectedValue;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sql = &quot;select * from tbl_verification_master where description=&#39;&quot; + drpmov.SelectedItem.Text + &quot;&#39;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds = SqlHelper.ExecuteDataset(Cnn, CommandType.Text, sql);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ds.Tables[0].Rows.Count &amp;gt; 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; drpmov.DataSource = ds.Tables[0];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpmov.DataTextField = &quot;description&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpmov.DataValueField = &quot;id&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; drpmov.DataBind();&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; string drpmovvalue = drpmov.SelectedValue;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; txtglobal.Text = txtglobal.Text.ToUpper();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (txtglobal.Text == &quot;GLOBAL&quot;)&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; txtglobal.Text = &quot;2&quot;;&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; else if (txtglobal.Text == &quot;INDIA&quot;)&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; txtglobal.Text = &quot;1&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; txtglobal.Text = &quot;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sql = &quot;update tbl_Individual_Task set &amp;nbsp;Activitydescnational=&#39;&quot; + txtactivity.Text + &quot;&#39;, output=&#39;&quot; + txtoutput.Text + &quot;&#39;, global=&#39;&quot; + txtglobal.Text + &quot;&#39;,month_due=&#39;&quot; + drpdeadlinevalue + &quot;&#39;, mov=&#39;&quot; + drpmovvalue + &quot;&#39; where level3taskno=&#39;&quot; + GridView1.DataKeys[e.RowIndex].Values[1].ToString() + &quot;&#39;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlHelper.ExecuteNonQuery(Cnn, CommandType.Text, sql);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView1.EditIndex = -1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bindgrid(GridView1, GridView1.DataKeys[e.RowIndex][0].ToString());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView GridView1 = (GridView)sender;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sql = &quot;delete tbl_Individual_Task where level3taskno=&#39;&quot; + GridView1.DataKeys[e.RowIndex].Values[1].ToString() + &quot;&#39;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // SqlHelper.ExecuteNonQuery(Cnn, CommandType.Text, sql);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bindgrid(GridView1, GridView1.DataKeys[e.RowIndex][0].ToString());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; protected void GridView2_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView GridView1 = (GridView)sender;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView1.EditIndex = -1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bindgrid(GridView1, GridView1.DataKeys[e.RowIndex][0].ToString());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/1390916440036103570/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2014/08/nested-girdview-in-datalist-cancel.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/1390916440036103570'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/1390916440036103570'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2014/08/nested-girdview-in-datalist-cancel.html' title='nested girdview in datalist cancel update delete c#'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-3427487640118535571</id><published>2014-08-27T02:32:00.000-07:00</published><updated>2014-08-27T02:32:01.974-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><title type='text'>Getting Client Ip address and computer name in c#</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp;using system .net;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;/* host address */&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string strHostName = System.Net.Dns.GetHostEntry(Request.UserHostAddress).HostName;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lblip.Text = Request.UserHostAddress.ToString();&lt;br /&gt;
&lt;br /&gt;
when you upload your code on server then in website you&#39;ll get your exact value.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/3427487640118535571/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2014/08/getting-client-ip-address-and-computer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/3427487640118535571'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/3427487640118535571'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2014/08/getting-client-ip-address-and-computer.html' title='Getting Client Ip address and computer name in c#'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-5776407440868450127</id><published>2014-05-07T23:51:00.001-07:00</published><updated>2014-05-07T23:51:34.123-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><title type='text'>Insert new row in gridview when no data in gridview</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&amp;nbsp;sql = &quot;select * from tblbkdetails where formid=&#39;&quot; + formid + &quot;&#39;&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds = SqlHelper.ExecuteDataset(Cnn, CommandType.Text, sql);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //grdshow.DataSource = ds.Tables[0];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //grdshow.DataBind();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (ds.Tables[0].Rows.Count &amp;gt; 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; GridView2.DataSource = ds.Tables[0];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView2.DataBind();&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;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds.Tables[0].Rows.Add(ds.Tables[0].NewRow());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView2.DataSource = ds;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView2.DataBind();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int columncount = GridView2.Rows[0].Cells.Count;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView2.Rows[0].Cells.Clear();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView2.Rows[0].Cells.Add(new TableCell());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView2.Rows[0].Cells[0].ColumnSpan = columncount;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GridView2.Rows[0].Cells[0].Text = &quot;There is no Records &quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/5776407440868450127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2014/05/insert-new-row-in-gridview-when-no-data.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/5776407440868450127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/5776407440868450127'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2014/05/insert-new-row-in-gridview-when-no-data.html' title='Insert new row in gridview when no data in gridview'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-916940656000951105</id><published>2013-11-07T22:38:00.001-08:00</published><updated>2013-11-07T22:38:19.445-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Samsung Omnia w"/><title type='text'>How can i disable autocorrect function on Windows Phone 7.5</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hello Guys,&lt;div&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;lots of time when i am chatting with my friends, then m using some Hindi words but auto-complete function replace some words with English words. so i was very disappoint with the facilities .&lt;/div&gt;
&lt;div&gt;
so now m going to telling you how can you solved this problem.&lt;/div&gt;
&lt;div&gt;
just go into your setting&amp;gt;&amp;gt;Keyboard&amp;gt;&amp;gt;typing settings&amp;gt;&amp;gt;press to change&amp;gt;&amp;gt;uncheck Correct Misspelt words.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
i hope it&#39;ll be a very userfull for you...&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/916940656000951105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2013/11/how-can-i-disable-autocorrect-function.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/916940656000951105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/916940656000951105'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2013/11/how-can-i-disable-autocorrect-function.html' title='How can i disable autocorrect function on Windows Phone 7.5'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-1152538652371225897</id><published>2013-10-08T23:13:00.001-07:00</published><updated>2013-10-08T23:13:08.548-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><title type='text'>C# - Generics</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Generics allow you to delay the specification of the data type of programming elements in a class or a method, until it is actually used in the program. In other words, generics allow you to write a class or method that can work with any data type.&lt;br /&gt;
&lt;br /&gt;
You write the specifications for the class or the method, with substitute parameters for data types. When the compiler encounters a constructor for the class or a function call for the method, it generates code to handle the specific data type. A simple example would help understanding the concept:&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
&lt;br /&gt;
namespace GenericApplication&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public class MyGenericArray&amp;lt;T&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private T[] array;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public MyGenericArray(int size)&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; array = new T[size + 1];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public T getItem(int index)&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; return array[index];&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public void setItem(int index, T value)&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; array[index] = value;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; class Tester&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; static void Main(string[] args)&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; //declaring an int array&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyGenericArray&amp;lt;int&amp;gt; intArray = new MyGenericArray&amp;lt;int&amp;gt;(5);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //setting values&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int c = 0; c &amp;lt; 5; c++)&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; intArray.setItem(c, c*5);&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; //retrieving the values&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int c = 0; c &amp;lt; 5; c++)&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; Console.Write(intArray.getItem(c) + &quot; &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; Console.WriteLine();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //declaring a character array&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyGenericArray&amp;lt;char&amp;gt; charArray = new MyGenericArray&amp;lt;char&amp;gt;(5);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //setting values&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int c = 0; c &amp;lt; 5; c++)&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; charArray.setItem(c, (char)(c+97));&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; //retrieving the values&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int c = 0; c&amp;lt; 5; c++)&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; Console.Write(charArray.getItem(c) + &quot; &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; Console.WriteLine();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.ReadKey();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
When the above code is compiled and executed, it produces the following result:&lt;br /&gt;
&lt;br /&gt;
0 5 10 15 20&lt;br /&gt;
a b c d e&lt;br /&gt;
Features of Generics&lt;br /&gt;
Using generics is a technique that enriches your programs in the following ways:&lt;br /&gt;
&lt;br /&gt;
It helps you to maximize code reuse, type safety, and performance.&lt;br /&gt;
&lt;br /&gt;
You can create generic collection classes. The .NET Framework class library contains several new generic collection classes in the System.Collections.Generic namespace. You may use these generic collection classes instead of the collection classes in the System.Collections namespace.&lt;br /&gt;
&lt;br /&gt;
You can create your own generic interfaces, classes, methods, events and delegates.&lt;br /&gt;
&lt;br /&gt;
You may create generic classes constrained to enable access to methods on particular data types.&lt;br /&gt;
&lt;br /&gt;
You may get information on the types used in a generic data type at run-time by means of reflection.&lt;br /&gt;
&lt;br /&gt;
Generic Methods&lt;br /&gt;
In the previous example, we have used a generic class; we can declare a generic method with a type parameter. The following program illustrates the concept:&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
&lt;br /&gt;
namespace GenericMethodAppl&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; class Program&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; static void Swap&amp;lt;T&amp;gt;(ref T lhs, ref T rhs)&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; T temp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; temp = lhs;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lhs = rhs;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; rhs = temp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; static void Main(string[] args)&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; int a, b;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; char c, d;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a = 10;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; b = 20;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; c = &#39;I&#39;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; d = &#39;V&#39;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //display values before swap:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;Int values before calling swap:&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;a = {0}, b = {1}&quot;, a, b);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;Char values before calling swap:&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;c = {0}, d = {1}&quot;, c, d);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call swap&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Swap&amp;lt;int&amp;gt;(ref a, ref b);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Swap&amp;lt;char&amp;gt;(ref c, ref d);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //display values after swap:&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;Int values after calling swap:&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;a = {0}, b = {1}&quot;, a, b);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;Char values after calling swap:&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;c = {0}, d = {1}&quot;, c, d);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.ReadKey();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
When the above code is compiled and executed, it produces the following result:&lt;br /&gt;
&lt;br /&gt;
Int values before calling swap:&lt;br /&gt;
a = 10, b = 20&lt;br /&gt;
Char values before calling swap:&lt;br /&gt;
c = I, d = V&lt;br /&gt;
Int values after calling swap:&lt;br /&gt;
a = 20, b = 10&lt;br /&gt;
Char values after calling swap:&lt;br /&gt;
c = V, d = I&lt;br /&gt;
Generic Delegates&lt;br /&gt;
You can define a generic delegate with type parameters. For example:&lt;br /&gt;
&lt;br /&gt;
delegate T NumberChanger&amp;lt;T&amp;gt;(T n);&lt;br /&gt;
The following example shows use of this delegate:&lt;br /&gt;
&lt;br /&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
&lt;br /&gt;
delegate T NumberChanger&amp;lt;T&amp;gt;(T n);&lt;br /&gt;
namespace GenericDelegateAppl&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; class TestDelegate&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; static int num = 10;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int AddNum(int p)&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; num += p;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return num;&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; public static int MultNum(int q)&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; num *= q;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return num;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int getNum()&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; return num;&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; static void Main(string[] args)&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; //create delegate instances&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NumberChanger&amp;lt;int&amp;gt; nc1 = new NumberChanger&amp;lt;int&amp;gt;(AddNum);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; NumberChanger&amp;lt;int&amp;gt; nc2 = new NumberChanger&amp;lt;int&amp;gt;(MultNum);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //calling the methods using the delegate objects&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nc1(25);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;Value of Num: {0}&quot;, getNum());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; nc2(5);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&quot;Value of Num: {0}&quot;, getNum());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.ReadKey();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
When the above code is compiled and executed, it produces the following result:&lt;br /&gt;
&lt;br /&gt;
Value of Num: 35&lt;br /&gt;
Value of Num: 175&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/1152538652371225897/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2013/10/c-generics_8.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/1152538652371225897'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/1152538652371225897'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2013/10/c-generics_8.html' title='C# - Generics'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-8296238145659221432</id><published>2013-09-24T02:57:00.001-07:00</published><updated>2013-09-24T02:57:24.279-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><title type='text'>Design Tip #107 Using the SQL MERGE Statement for Slowly Changing Dimension Processing</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Most ETL tools provide some functionality for handling slowly changing dimensions. Every so often, when the tool isn’t performing as needed, the ETL developer will use the database to identify new and changed rows, and apply the appropriate inserts and updates. I’ve shown examples of this code in the Data Warehouse Lifecycle in Depth class using standard INSERT and UPDATE statements. A few months ago, my friend Stuart Ozer suggested the new MERGE command in SQL Server 2008 might be more efficient, both from a code and an execution perspective. His reference to a blog by Chad Boyd on MSSQLTips.com gave me some pointers on how it works. MERGE is a combination INSERT, UPDATE and DELETE that provides significant control over what happens in each clause.&lt;br /&gt;
&lt;br /&gt;
This example handles a simple customer dimension with two attributes: first name and last name. We are going to treat first name as a Type 1 and last name as a Type 2. Remember, Type 1 is where we handle a change in a dimension attribute by overwriting the old value with the new value; Type 2 is where we track history by adding a new row that becomes effective when the new value appears.&lt;br /&gt;
&lt;br /&gt;
Step 1: Overwrite the Type 1 Changes&lt;br /&gt;
I tried to get the entire example working in a single MERGE statement, but the function is deterministic and only allows one update statement, so I had to use a separate MERGE for the Type 1 updates. This could also be handled with an update statement since Type 1 is an update by definition.&lt;br /&gt;
&lt;br /&gt;
MERGE INTO dbo.Customer_Master AS CM&lt;br /&gt;
USING Customer_Source AS CS&lt;br /&gt;
ON (CM.Source_Cust_ID = CS.Source_Cust_ID)&lt;br /&gt;
WHEN MATCHED AND — Update all existing rows for Type 1 changes&lt;br /&gt;
CM.First_Name &amp;lt;&amp;gt; CS.First_Name&lt;br /&gt;
THEN UPDATE SET CM.First_Name = CS.First_Name&lt;br /&gt;
&lt;br /&gt;
This is a simple version of the MERGE syntax that says merge the Customer_Source table into the Customer_Master dimension by joining on the business key, and update all matched rows where First_Name in the master table does not equal the First_Name in the source table.&lt;br /&gt;
&lt;br /&gt;
Step 2: Handle the Type 2 Changes&lt;br /&gt;
Now we’ll do a second MERGE statement to handle the Type 2 changes.&lt;br /&gt;
&lt;br /&gt;
This is where things get a little tricky because there are several steps involved in tracking Type 2 changes. Our code will need to:&lt;br /&gt;
&lt;br /&gt;
1. Insert brand new customer rows with the appropriate effective and end dates&lt;br /&gt;
2. Expire the old rows for those rows that have a Type 2 attribute change by setting the appropriate end date and current_row flag = ‘n’&lt;br /&gt;
3. Insert the changed Type 2 rows with the appropriate effective and end dates and current_row flag = ‘y’&lt;br /&gt;
&lt;br /&gt;
The problem with this is it’s one too many steps for the MERGE syntax to handle. Fortunately, the MERGE can stream its output to a subsequent process. We’ll use this to do the final insert of the changed Type 2 rows by INSERTing into the Customer_Master table using a SELECT from the MERGE results. This sounds like a convoluted way around the problem, but it has the advantage of only needing to find the Type 2 changed rows once, and then using them multiple times.&lt;br /&gt;
&lt;br /&gt;
The code starts with the outer INSERT and SELECT clause to handle the changed row inserts at the end of the MERGE statement. This has to come first because the MERGE is nested inside the INSERT. The code includes several references to getdate; the code presumes the change was effective yesterday (getdate()-1) which means the prior version would be expired the day before (getdate()-2). Finally, following the code, there are comments that refer to the line numbers&lt;br /&gt;
&lt;br /&gt;
1 INSERT INTO Customer_Master&lt;br /&gt;
2 SELECT Source_Cust_ID, First_Name, Last_Name, Eff_Date, End_Date, Current_Flag&lt;br /&gt;
3 FROM&lt;br /&gt;
4 ( MERGE Customer_Master CM&lt;br /&gt;
5 USING Customer_Source CS&lt;br /&gt;
6 ON (CM.Source_Cust_ID = CS.Source_Cust_ID)&lt;br /&gt;
7 WHEN NOT MATCHED THEN&lt;br /&gt;
8 INSERT VALUES (CS.Source_Cust_ID, CS.First_Name, CS.Last_Name, convert(char(10), getdate()-1, 101), ’12/31/2199′, ‘y’)&lt;br /&gt;
9 WHEN MATCHED AND CM.Current_Flag = ‘y’&lt;br /&gt;
10 AND (CM.Last_Name &amp;lt;&amp;gt; CS.Last_Name ) THEN&lt;br /&gt;
11 UPDATE SET CM.Current_Flag = ‘n’, CM.End_date = convert(char(10), getdate()- 2, 101)&lt;br /&gt;
12 OUTPUT $Action Action_Out, CS.Source_Cust_ID, CS.First_Name, CS.Last_Name, convert(char(10), getdate()-1, 101) Eff_Date, ’12/31/2199′ End_Date, ‘y’Current_Flag&lt;br /&gt;
13 ) AS MERGE_OUT&lt;br /&gt;
14 WHERE MERGE_OUT.Action_Out = ‘UPDATE’;&lt;br /&gt;
&lt;br /&gt;
Code Comments&lt;br /&gt;
Lines 1-3 set up a typical INSERT statement. What we will end up inserting are the new values of the Type 2 rows that have changed.&lt;br /&gt;
&lt;br /&gt;
Line 4 is the beginning of the MERGE statement which ends at line 13. The MERGE statement has an OUTPUT clause that will stream the results of the MERGE out to the calling function. This syntax defines a common table expression, essentially a temporary table in the FROM clause, called MERGE_OUT.&lt;br /&gt;
&lt;br /&gt;
Lines 4-6 instruct the MERGE to load Customer_Source data into the Customer_Master dimension table.&lt;br /&gt;
&lt;br /&gt;
Line 7 says when there is no match on the business key, we must have a new customer, so Line 8 does the INSERT. You could parameterize the effective date instead of assuming yesterday’s date.&lt;br /&gt;
&lt;br /&gt;
Lines 9 and 10 identify a subset of the rows with matching business keys, specifically, where it’s the current row in the Customer_Master AND any one of the Type 2 columns is different.&lt;br /&gt;
&lt;br /&gt;
Line 11 expires the old current row in the Customer_Master by setting the end date and current row flag to ‘n’.&lt;br /&gt;
&lt;br /&gt;
Line 12 is the OUTPUT clause which identifies what attributes will be output from the MERGE, if any.&lt;br /&gt;
&lt;br /&gt;
This is what will feed into the outer INSERT statement. The $Action is a MERGE function that tells us what part of the MERGE each row came from. Note that the OUTPUT can draw from both the source and the master. In this case, we are outputting source attributes because they contain the new Type 2 values.&lt;br /&gt;
&lt;br /&gt;
Line 14 limits the output row set to only the rows that were updated in Customer_Master. These correspond to the expired rows in Line 11, but we output the current values from Customer_Source in Line 12.&lt;br /&gt;
&lt;br /&gt;
Summary&lt;br /&gt;
The big advantage of the MERGE statement is being able to handle multiple actions in a single pass of the data sets, rather than requiring multiple passes with separate inserts and updates. A well tuned optimizer could handle this extremely efficiently.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/8296238145659221432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2013/09/design-tip-107-using-sql-merge.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/8296238145659221432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/8296238145659221432'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2013/09/design-tip-107-using-sql-merge.html' title='Design Tip #107 Using the SQL MERGE Statement for Slowly Changing Dimension Processing'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-4868076717334515352</id><published>2013-09-20T00:28:00.000-07:00</published><updated>2013-09-20T00:30:16.825-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Samsung Omnia w"/><title type='text'>DNS Server is not responding on Windows 7 </title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Segoe UI, Tahoma, Verdana, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 20px;&quot;&gt;When you try to connect to the Internet, the connection might fail when we run the Troubleshooter and you might get this error: &amp;nbsp; The device or resource (DNS server) is not responding.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Segoe UI, Tahoma, Verdana, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&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/AVvXsEhMgNYEwQnf8f1bFc3xb9nBEDknroyvda5PSWnWOY7CnSNGxxClYINDXYYEPUZ9p5RgTa8mW-YKVWLGATYKIhI0l5Ed2IR-OxGlSVqjQdAQIWptFo4VarVXf1LTP5Q0UlrSU9R1X56l-LQ/s1600/11.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;242&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMgNYEwQnf8f1bFc3xb9nBEDknroyvda5PSWnWOY7CnSNGxxClYINDXYYEPUZ9p5RgTa8mW-YKVWLGATYKIhI0l5Ed2IR-OxGlSVqjQdAQIWptFo4VarVXf1LTP5Q0UlrSU9R1X56l-LQ/s320/11.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
DNS Server is not responding&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
In such a scenario, there are few things you could try to resolve it.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
1. &amp;nbsp; &amp;nbsp; &amp;nbsp; First backup your Router settings and update the Firmware of your Router. Check the Router manual for more information&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
2. &amp;nbsp; &amp;nbsp; &amp;nbsp; Next thing is to change the DNS server address manually.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Go to Start and Click on Control Panel&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Open up Network and Internet and go to the Network and Sharing Center.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Click on Change adapter settings&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEjGf-TpTETQ4vX_OPrcPv-tBbCyexF_19iDglrAv0pMAg09qxHGaZB0o5J17kIpKdNK2WWbXdDrmzRtRKxmoiFjCNoi8alxng1YbROEzGe0Pi9xOZoMQui0XUoNXRSCbyxHjbV-k2V_CiU/s1600/2.png&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/AVvXsEjGf-TpTETQ4vX_OPrcPv-tBbCyexF_19iDglrAv0pMAg09qxHGaZB0o5J17kIpKdNK2WWbXdDrmzRtRKxmoiFjCNoi8alxng1YbROEzGe0Pi9xOZoMQui0XUoNXRSCbyxHjbV-k2V_CiU/s1600/2.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Now you’ll see the list of Network adapters select the Network adapter &amp;nbsp;that your using and right click on it and go to properties&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEjzcOfWHfz_UxrHSH8VGX1Ac7CmT_bggd9IvZ-2jihqI95ZcZvoU7aTqPCdAnzlPfX2HafMV2cLqn4aoecsY5nppzXKA36tITz4dLWIMWsn_tjoqVcC6CVo70MPXJXKS36lc9rTq4C3Vas/s1600/31-600x379.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;202&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzcOfWHfz_UxrHSH8VGX1Ac7CmT_bggd9IvZ-2jihqI95ZcZvoU7aTqPCdAnzlPfX2HafMV2cLqn4aoecsY5nppzXKA36tITz4dLWIMWsn_tjoqVcC6CVo70MPXJXKS36lc9rTq4C3Vas/s320/31-600x379.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Then Click on “Internet Protocol Version 4 (TCP/IPv4)”&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
You’ll see the Internet Protocol Properties&lt;/div&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/AVvXsEjhwnvibXrgNiYwYGlWZJxNU8a0SpckxyUu-O4ITp5lr9gFGdCbJqjnw88ion4gK_v8wbhwX5-a8hRjEbj-M1QUU0E80r7yKPOyTI-PDl2lYY_L-zWjHXR4AuegWIe97BF575EiiewHZ6s/s1600/41.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhwnvibXrgNiYwYGlWZJxNU8a0SpckxyUu-O4ITp5lr9gFGdCbJqjnw88ion4gK_v8wbhwX5-a8hRjEbj-M1QUU0E80r7yKPOyTI-PDl2lYY_L-zWjHXR4AuegWIe97BF575EiiewHZ6s/s320/41.png&quot; width=&quot;285&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Select “Use the Following DNS server address:”&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Enter the Preferred DNS address: &amp;nbsp; 208.67.222.222&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Enter the Alternative DNS address: 208.67.220.220&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Then select on Validate settings upon exit.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&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/AVvXsEhDllKN5PM4T83I69dNtp1hTrhKOxQG5desqaI9pSoue02vZVNFm3GOoYBGiU6cx5ys1tRhgn316UhpEKKEbuP4JE2DCS0qDodxoNuUoTA9iObUOBcZXRrV1pOwxwiTn4zkTN1Y0dLF5Nw/s1600/511.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDllKN5PM4T83I69dNtp1hTrhKOxQG5desqaI9pSoue02vZVNFm3GOoYBGiU6cx5ys1tRhgn316UhpEKKEbuP4JE2DCS0qDodxoNuUoTA9iObUOBcZXRrV1pOwxwiTn4zkTN1Y0dLF5Nw/s320/511.png&quot; width=&quot;289&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Click OK, and then Close to finish.&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Segoe UI, Tahoma, Verdana, Arial, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 20px;&quot;&gt;I hope it&#39;ll be helpful for you ... give your feedback about your post...&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/4868076717334515352/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2013/09/dns-server-is-not-responding-on-windows.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/4868076717334515352'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/4868076717334515352'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2013/09/dns-server-is-not-responding-on-windows.html' title='DNS Server is not responding on Windows 7 '/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMgNYEwQnf8f1bFc3xb9nBEDknroyvda5PSWnWOY7CnSNGxxClYINDXYYEPUZ9p5RgTa8mW-YKVWLGATYKIhI0l5Ed2IR-OxGlSVqjQdAQIWptFo4VarVXf1LTP5Q0UlrSU9R1X56l-LQ/s72-c/11.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-7689388257073740507</id><published>2013-09-17T05:10:00.001-07:00</published><updated>2013-09-17T05:10:21.294-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><title type='text'>How to find the table name in the database that have triggers</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
SELECT DISTINCT&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;o.[name] AS [Table]&lt;br /&gt;
FROM&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[sysobjects] o&lt;br /&gt;
JOIN&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[sysobjects] tr&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;ON&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;o.[id] = tr.[parent_obj]&lt;br /&gt;
WHERE&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;tr.[type] = &#39;tr&#39;&lt;br /&gt;
ORDER BY [Table]&lt;br /&gt;
&lt;br /&gt;
If you want to know all name of the triggers then run the query&lt;br /&gt;
&lt;br /&gt;
select * from sys.triggers&lt;br /&gt;
&lt;br /&gt;
hope it&#39;ll helpfull&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/7689388257073740507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2013/09/how-to-find-table-name-in-database-that.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/7689388257073740507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/7689388257073740507'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2013/09/how-to-find-table-name-in-database-that.html' title='How to find the table name in the database that have triggers'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-6577398250330052466</id><published>2013-04-06T02:27:00.002-07:00</published><updated>2013-05-12T22:56:43.176-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><title type='text'> An example of Arrays,ArrayList,generic collections in an ASP.Net application !!!</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;
In one of my ASP.Net seminars I have been asked to provide a small sample/example on working with a group of custom objects.&lt;br /&gt;
I have created a small example/site with ASP.Net &amp;amp; C# and &amp;nbsp;thought it might be a good idea to share it with you.&lt;br /&gt;
More specifically I have been asked to create a small ASP.Net web site where I will demonstrate the use of arrays with objects,ArrayLists with objects and generic collections with objects.&lt;br /&gt;
I know some people will find this post&#39;s contents pretty basic but for those junior developers out there, I hope it is really helpful.&lt;br /&gt;
Let&#39;s demonstrate that using our usual methodology, a hands-on step by step example.&lt;br /&gt;
We will start with an array of objects first.&lt;br /&gt;
1) Launch Visual Studio 2010/2008/2005. Express editions work fine.&lt;br /&gt;
2) Create a new empty website and give it an appropriate name.Choose C# as the development language.&lt;br /&gt;
3) &amp;nbsp;Add a new item in your site, a web form item. Leave the default name, so it is calledDefault.aspx.&lt;br /&gt;
4) Add a new item in your site, a class file.Name the class file Person.cs.&lt;br /&gt;
5) The whole code for the Person.cs class follows&lt;br /&gt;
public class Person&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; #region &amp;nbsp;define public properties of my person class&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string FirstName { get; set; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string LastName { get; set; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string Email { get; set; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public decimal Height { get; set; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public decimal Weight { get; set; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; #endregion&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; #region calculatecurrentage&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public int CalculateCurrentAge(DateTime dob)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int years = DateTime.Now.Year - dob.Year;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (DateTime.Now.Month &amp;lt; dob.Month ||&lt;br /&gt;
(DateTime.Now.Month == dob.Month &amp;amp;&amp;amp; DateTime.Now.Day &amp;lt; dob.Day))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; years--;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return years;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; #endregion&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string DisplayFullName()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string info;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; info = &quot;FullName is: &quot; + FirstName + &quot; &quot; + LastName;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return info;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
6) So as you see this is a fairly easy class with 5 public properties and 2 public methods. Place the Person.cs in the special folder App_Code.If this special folder is not created, you can create it yourself by right-clicking on your site&#39;s name and from the submenu click &quot;Add ASP.Net Folder&quot;.&lt;br /&gt;
I am not using public fields. I want you to make a note of that. I am using C# 3.0 syntax using Auto-implemented properties. The compiler creates the appropriate private fields. In general it is a good practice to have your fields private and make the properties public. I also have created 2 easy to understand public methods.&lt;br /&gt;
7) So now we do have our custom object/type. Let&#39;s see how to group these objects in an array of objects. In the default.aspx inside the Page_Load event handling routine type,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person[] people = new Person[3];&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person p1 = new Person();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.FirstName = &quot;Nikos&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.LastName = &quot;Kantzelis&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.Email = &quot;nikolaosk@hotmail.com&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.Height = 1.78m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.Weight = 88.5m;&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person p2 = new Person();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.FirstName = &quot;James&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.LastName = &quot;Rowling&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.Email = &quot;jamesr@hotmail.com&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.Height = 1.98m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.Weight = 98.25m;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person p3 = new Person();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.FirstName = &quot;George&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.LastName = &quot;Graham&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.Email = &quot;graham@yahoo.co.uk&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.Height = 1.88m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.Weight = 81.5m;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; people[0] = p1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; people[1] = p2;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; people[2] = p3;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0; i &amp;lt; 3; i++)&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; string peopleinfo;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; peopleinfo = people[i].DisplayFullName();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(peopleinfo);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(&quot;&amp;lt;br/&amp;gt;&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
8) Run your application and see the fullname of our Person object printed in the screen. The code I have written in the Page_Load routine is not difficult to follow.&lt;br /&gt;
First I create a new array of Person objects and set the size to 3 elements.Then I create 3 instances of the Person class and fill in the public properties with random values.&lt;br /&gt;
Then I place those reference variables (p1-p3) inside our array (people).&lt;br /&gt;
Finally I loop inside the array and print the fullname of each object by calling theDisplayFullName() method of the Person class.&lt;br /&gt;
This works fine but there are some limitations. One of them is that you have to know beforehand how many items we must place in the array.&lt;br /&gt;
An alternative way is to use &amp;nbsp;ArrayLists.&lt;br /&gt;
So let&#39;s move on to our more efficient way of storing group of custom objects. In this example we will use an ArrayList object.&lt;br /&gt;
9) Drag and drop a button in the default.aspx page. Leave the default name. Double click on the button to create the Button1_Click event handling routine.Comment out all of your code in the Page_Load event handling routine.&lt;br /&gt;
10) &amp;nbsp;We will use of course the Person class. Inside the Button1_Click event handling routine type,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ArrayList people = new &amp;nbsp;ArrayList();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person p1 = new Person();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.FirstName = &quot;Nikos&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.LastName = &quot;Kantzelis&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.Email = &quot;nikolaosk@hotmail.com&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.Height = 1.78m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.Weight = 88.5m;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person p2 = new Person();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.FirstName = &quot;James&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.LastName = &quot;Rowling&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.Email = &quot;jamesr@hotmail.com&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.Height = 1.98m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.Weight = 98.25m;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person p3 = new Person();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.FirstName = &quot;George&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.LastName = &quot;Graham&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.Email = &quot;graham@yahoo.co.uk&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.Height = 1.88m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.Weight = 81.5m;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; people.Add(p1);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; people.Add(p2);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; people.Add(p3);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; foreach (object item in people)&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; Person myperson = (Person)item;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(myperson.DisplayFullName());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(&quot;&amp;lt;br/&amp;gt;&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
11) Run your application and see the results exactly as before when we used a simple Array object.&lt;br /&gt;
Make sure you have added the using System.Collections; in the top of your file.&lt;br /&gt;
I am just creating a new instance of the ArrayList object&lt;br /&gt;
ArrayList people = new &amp;nbsp;ArrayList();&lt;br /&gt;
Then I create 3 intances of the Person custom object and fill in the values as previously.Then I use the Add method to add those objects in my ArrayList object.&lt;br /&gt;
The Add method of the Arraylist class accepts a parameter of type Object.So when we add a Person object as we do in our example that object has to be casted to an instance of type Object.&lt;br /&gt;
This process is also known as boxing. The reverse process is known as unboxing. This pair of processes has impact on application’s performance.&lt;br /&gt;
Then I just loop through the items and print the relevant information.&lt;br /&gt;
Now add another object in the ArrayList. We can do that with ArrayLists but not with simple Arrays of objects.You type the following code just after the foreach block of code,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person p4 = new Person();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p4.FirstName = &quot;Mary&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p4.LastName = &quot;Stewart&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p4.Email = &quot;marystewart@yahoo.co.uk&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p4.Height = 1.71m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p4.Weight = 61.5m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; people.Insert(2, p4);&lt;br /&gt;
&amp;nbsp;12) Now add this code again after you have inserted a 4th object in the array list.&lt;br /&gt;
&amp;nbsp;foreach (object item in people)&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; Person myperson = (Person)item;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(myperson.DisplayFullName());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(&quot;&amp;lt;br/&amp;gt;&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp;13) Run your application, click on the button, and see the new object added in the ArrayList in the correct position.So with ArrayLists we do have more power as developers when it comes to grouping objects in arrays.&lt;br /&gt;
&amp;nbsp;Now let&#39;s see a limitation of ArrayLists. Add another class file to your site and name isAnimal.cs. The code inside the .cs file should be something like this&lt;br /&gt;
public class Animal&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public bool isMammal { get; set; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public string Species { get; set; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public double Speed { get; set; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public decimal Height { get; set; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public decimal Weight { get; set; }&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
I am not bothered at this time to add any public methods. Switch back to yourdefault.aspx.cs file and in the end of the Button1_Click event handling routine type something like this&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Animal myanimal = new Animal();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myanimal.isMammal = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myanimal.Species = &quot;Panthera&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myanimal.Speed = 56.8;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myanimal.Height = 0.78m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myanimal.Weight = 163;&lt;br /&gt;
Now add this line of code just below the instantiation of your animal object.&lt;br /&gt;
people.Add(myanimal);&lt;br /&gt;
&amp;nbsp;Compile your application and see tha it compiles just fine.Now if you add this code just after the previous line&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;foreach (object item in people)&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; &amp;nbsp; Person myperson = (Person)item;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(myperson.DisplayFullName());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(&quot;&amp;lt;br/&amp;gt;&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
and build your application, your application will build just fine. Now run your application and you will get an exception (InvalidCastException).It cannot cast something of type Animalto Person.&lt;br /&gt;
&lt;br /&gt;
14) Now let&#39;s improve our code with the use of generic collections. With .Net Framework 2.0 generic collections were introduced. A generic collection is basically a container that can be used to store objects of any class. What we do is we simply define a generic version of ArrayList by using the syntax of List&amp;lt;T&amp;gt;. T stands for type parameter, indicating that the type of the member objects in the list has not yet specified. We can replace T with any class or object. T gets replaced by the data type at compile time.&lt;br /&gt;
First add another button in the default.aspx page. Leave the default name.Double click on the button to create the Button2_Click event handling routine and type inside it&lt;br /&gt;
&amp;nbsp;List&amp;lt;Person&amp;gt; people = new List&amp;lt;Person&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person p1 = new Person();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.FirstName = &quot;Nikos&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.LastName = &quot;Kantzelis&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.Email = &quot;nikolaosk@hotmail.com&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.Height = 1.78m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p1.Weight = 88.5m;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person p2 = new Person();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.FirstName = &quot;James&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.LastName = &quot;Rowling&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.Email = &quot;jamesr@hotmail.com&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.Height = 1.98m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p2.Weight = 98.25m;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Person p3 = new Person();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.FirstName = &quot;George&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.LastName = &quot;Graham&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.Email = &quot;graham@yahoo.co.uk&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.Height = 1.88m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; p3.Weight = 81.5m;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; people.Add(p1);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; people.Add(p2);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; people.Add(p3);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; foreach (Person item in people)&lt;br /&gt;
&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; Response.Write(item.DisplayFullName());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(&quot;&amp;lt;br/&amp;gt;&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
Run your code and it will work just fine. The only thing we have changed so far is this line of code&lt;br /&gt;
ArrayList people = new &amp;nbsp;ArrayList();&lt;br /&gt;
with this line of code&lt;br /&gt;
List&amp;lt;Person&amp;gt; people = new List&amp;lt;Person&amp;gt;();&lt;br /&gt;
&amp;nbsp;and this foreach statement&lt;br /&gt;
&amp;nbsp;foreach (object item in people)&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; &amp;nbsp; Person myperson = (Person)item;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(myperson.DisplayFullName());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(&quot;&amp;lt;br/&amp;gt;&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
with this one&lt;br /&gt;
&amp;nbsp; &amp;nbsp;foreach (Person item in people)&lt;br /&gt;
&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; Response.Write(item.DisplayFullName());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Response.Write(&quot;&amp;lt;br/&amp;gt;&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
We do not need casting anymore. Well that is awesome.&lt;br /&gt;
Now let&#39;s add an animal object.So just below the code we just typed add,&lt;br /&gt;
&amp;nbsp;Animal myanimal = new Animal();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myanimal.isMammal = true;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myanimal.Species = &quot;Panthera&quot;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myanimal.Speed = 56.8;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myanimal.Height = 0.78m;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; myanimal.Weight = 163;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; people.Add(myanimal);&lt;br /&gt;
&lt;br /&gt;
Try to build this application to see if it compiles. It will fail.It won&#39;t compile.Well this is a good thing since now we know (type safety) at compile time that we cannot add our animal object in the people collection.&lt;br /&gt;
There are ways to solve this problem but not with generic lists. The point I am trying to make in this post is a simple comparison ways that we group objects, hence a comparison of arrays,ArrayLists and Generic Collections. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Leave a comment ( or email me ) if you need the source code.&lt;br /&gt;
Hope it helps!!!&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://krishankayat.blogspot.com/feeds/6577398250330052466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2013/04/an-example-of-arraysarraylistgeneric.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/6577398250330052466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/6577398250330052466'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2013/04/an-example-of-arraysarraylistgeneric.html' title=' An example of Arrays,ArrayList,generic collections in an ASP.Net application !!!'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-7701050226215398873</id><published>2013-03-15T00:21:00.003-07:00</published><updated>2013-03-15T00:21:44.496-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><title type='text'>The OLE DB provider &quot;Microsoft.ACE.OLEDB.12.0&quot; has not been registered</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;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;If you run below SQL statement&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;---------------------------------------------------------&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;Select * into DBTable FROM OPENROWSET(&#39;Microsoft.ACE.OLEDB.12.0&#39;, &#39;Excel 12.0;Database=D:\myExcelFile.xlsx;HDR=YES&#39;, &#39;SELECT * FROM [Sheet1$]&#39;)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;INSERT INTO DBTable select * FROM OPENROWSET(&#39;Microsoft.ACE.OLEDB.12.0&#39;, &#39;Excel 12.0;Database=D:\myExcelFile.xlsx;HDR=YES&#39;, &#39;SELECT * FROM [Sheet1$]&#39;)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;span style=&quot;line-height: 19.5px;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;and you get an error message like below&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;The OLE DB provider &quot;Microsoft.ACE.OLEDB.12.0&quot; has not been registered&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;Solution&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;you need to download&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&quot;Data Connectivity Components for 2007 office system Driver&quot;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;after you download, please restart your server.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;color: #333333; font-family: Verdana, sans-serif; font-size: x-small;&quot;&gt;you can&amp;nbsp;&lt;a href=&quot;http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&amp;amp;id=23734&quot; rel=&quot;nofollow&quot; target=&quot;_blank&quot;&gt;click link here to download from microsoft site&lt;span style=&quot;background-color: #e0e0e0; font-size: 13px;&quot;&gt;.&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/7701050226215398873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2013/03/the-ole-db-provider-microsoftaceoledb12.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/7701050226215398873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/7701050226215398873'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2013/03/the-ole-db-provider-microsoftaceoledb12.html' title='The OLE DB provider &quot;Microsoft.ACE.OLEDB.12.0&quot; has not been registered'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-3533056737479340130</id><published>2013-02-20T22:04:00.001-08:00</published><updated>2014-11-13T03:48:21.729-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ASP.NET"/><title type='text'>sqlhelper.cs source code..</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.Data;&lt;br /&gt;
using System.Xml;&lt;br /&gt;
using System.Data.SqlClient;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
namespace Microsoft.ApplicationBlocks.Data&lt;br /&gt;
{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; /// The SqlHelper class is intended to encapsulate high performance, scalable best practices for&lt;br /&gt;
&amp;nbsp; &amp;nbsp; /// common uses of SqlClient.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public sealed class SqlHelper&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #region private utility methods &amp;amp; constructors&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Since this class provides only static methods, make the default constructor private to prevent&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //instances from being created with &quot;new SqlHelper()&quot;.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private SqlHelper() { }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method is used to attach array of SqlParameters to a SqlCommand.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method will assign a value of DbNull to any parameter with a direction of&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// InputOutput and a value of null. &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This behavior will prevent default values from being used, but&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// this will be the less common case than an intended pure output parameter (derived as InputOutput)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// where the user provided no input value.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;command&quot;&amp;gt;The command to which the parameters will be added&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParameters tho be added to command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static void AttachParameters(SqlCommand command, SqlParameter[] commandParameters)&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; foreach (SqlParameter p in commandParameters)&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; //check for derived output value with no value assigned&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((p.Direction == ParameterDirection.InputOutput) &amp;amp;&amp;amp; (p.Value == null))&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; p.Value = DBNull.Value;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &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; &amp;nbsp; &amp;nbsp; command.Parameters.Add(p);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method assigns an array of values to an array of SqlParameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;array of SqlParameters to be assigned values&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;array of objects holding the values to be assigned&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static void AssignParameterValues(SqlParameter[] commandParameters, object[] parameterValues)&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 ((commandParameters == null) || (parameterValues == 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; //do nothing if we get no data&lt;br /&gt;
&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; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // we must have the same number of values as we pave parameters to put them in&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (commandParameters.Length != parameterValues.Length)&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; throw new ArgumentException(&quot;Parameter count does not match Parameter Value count.&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &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; //iterate through the SqlParameters, assigning the values from the corresponding position in the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //value array&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0, j = commandParameters.Length; i &amp;lt; j; i++)&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; commandParameters[i].Value = parameterValues[i];&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method opens (if necessary) and assigns a connection, transaction, command type and parameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// to the provided command.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;command&quot;&amp;gt;the SqlCommand to be prepared&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection, on which to execute this command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction, or &#39;null&#39;&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParameters to be associated with the command or &#39;null&#39; if no parameters are required&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static void PrepareCommand(SqlCommand command, SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter[] commandParameters)&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 the provided connection is not open, we will open it&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (connection.State != ConnectionState.Open)&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; connection.Open();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &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; //associate the connection with the command&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; command.Connection = connection;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //set the command text (stored procedure name or SQL statement)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; command.CommandText = commandText;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //if we were provided a transaction, assign it.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (transaction != 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; command.Transaction = transaction;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &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; //set the command type&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; command.CommandType = commandType;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //attach the command parameters if they are provided&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (commandParameters != 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; AttachParameters(command, commandParameters);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &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; return;&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; #endregion private utility methods &amp;amp; constructors&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #region ExecuteNonQuery&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Jan 20, 2007 - Sadeer&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Added the ExecuteDeleteQuery method to support the History (Audit Trail) feature&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SQL delete statement against the database specified in the connection string.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;The given connection string to connect to the database&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;deleteText&quot;&amp;gt;The SQL DELETE statement to execute&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;userID&quot;&amp;gt;The 24/7 ID of the user invoking the DELETE&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;An integer representing the number of rows affected by the DELETE command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int ExecuteDeleteQuery(string connectionString, string deleteText, int userID)&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; // This function assumes that the given SQL query is actually a SQL DELETE statement.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string strDeleteText = deleteText.Trim().ToUpper();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (0 != strDeleteText.IndexOf(&quot;DELETE&quot;)) return -1;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // DELETE FROM table WHERE c1 = v1 AND ...&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int iStartIndex = strDeleteText.IndexOf(&quot;FROM&quot;) + &quot;FROM &quot;.Length;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int iEndIndex = strDeleteText.IndexOf(&quot;WHERE&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string strTableName = strDeleteText.Substring(iStartIndex, iEndIndex - iStartIndex);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Prepare the UPDATE statement&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string strUpdateText = @&quot;UPDATE &quot; + strTableName +&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&quot; SET [TimeStamp] = GetDate() AND [User_ID] = @UserID&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.Data.SqlClient.SqlParameter oParam = new SqlParameter(&quot;@UserID&quot;, userID);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Execute the UPDATE statement&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ExecuteNonQuery(connectionString, CommandType.Text, strUpdateText, oParam);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Finally, execute the DELETE statement&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteNonQuery(connectionString, CommandType.Text, deleteText, oParam);&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; // End - Jan 20, 2007&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Jan 29, 2007 - Sadeer&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SQL delete statement against the database specified in the transaction.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;The transaction this DELETE statement will be part of&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;deleteText&quot;&amp;gt;The SQL DELETE statement to execute&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;userID&quot;&amp;gt;The 24/7 ID of the user invoking the DELETE&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;An integer representing the number of rows affected by the DELETE command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int ExecuteDeleteQuery(SqlTransaction transaction, string deleteText, int userID)&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; // This function assumes that the given SQL query is actually a SQL DELETE statement.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string strDeleteText = deleteText.Trim().ToUpper();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (0 != strDeleteText.IndexOf(&quot;DELETE&quot;)) return -1;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // DELETE FROM table WHERE c1 = v1 AND ...&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int iStartIndex = strDeleteText.IndexOf(&quot;FROM&quot;) + &quot;FROM &quot;.Length;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int iEndIndex = strDeleteText.IndexOf(&quot;WHERE&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string strTableName = strDeleteText.Substring(iStartIndex, iEndIndex - iStartIndex);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Prepare the UPDATE statement&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string strUpdateText = @&quot;UPDATE &quot; + strTableName +&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; @&quot; SET [TimeStamp] = GetDate() AND [User_ID] = @UserID&quot;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.Data.SqlClient.SqlParameter oParam = new SqlParameter(&quot;@UserID&quot;, userID);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Finally, execute the DELETE statement&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteNonQuery(transaction, CommandType.Text, deleteText, oParam);&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; // End - Jan 29, 2007&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns no resultset and takes no parameters) against the database specified in&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// the connection string.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, &quot;PublishOrders&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an int representing the number of rows affected by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteNonQuery(connectionString, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns no resultset) against the database specified in the connection string&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, &quot;PublishOrders&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an int representing the number of rows affected by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //create &amp;amp; open a SqlConnection, and dispose of it after we are done.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; using (SqlConnection cn = new SqlConnection(connectionString))&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; cn.Open();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes a connection in place of the connection string&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteNonQuery(cn, commandType, commandText, commandParameters);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the database specified in&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// the connection string using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int result = ExecuteNonQuery(connString, &quot;PublishOrders&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored prcedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an int representing the number of rows affected by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int ExecuteNonQuery(string connectionString, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; //pull the parameters for this stored procedure from the parameter cache (or discover them &amp;amp; populate the cache)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //assign the provided values to these parameters based on parameter order&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes an array of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns no resultset and takes no parameters) against the provided SqlConnection.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, &quot;PublishOrders&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an int representing the number of rows affected by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int ExecuteNonQuery(SqlConnection connection, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteNonQuery(connection, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns no resultset) against the specified SqlConnection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, &quot;PublishOrders&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an int representing the number of rows affected by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int ExecuteNonQuery(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //create a command and prepare it for execution&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //finally, execute the command.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int retval = cmd.ExecuteNonQuery();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // detach the SqlParameters from the command object, so they can be used again.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Clear();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return retval;&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified SqlConnection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int result = ExecuteNonQuery(conn, &quot;PublishOrders&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an int representing the number of rows affected by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int ExecuteNonQuery(SqlConnection connection, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; //pull the parameters for this stored procedure from the parameter cache (or discover them &amp;amp; populate the cache)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection.ConnectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //assign the provided values to these parameters based on parameter order&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes an array of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteNonQuery(connection, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteNonQuery(connection, CommandType.StoredProcedure, spName);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns no resultset and takes no parameters) against the provided SqlTransaction.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int result = ExecuteNonQuery(trans, CommandType.StoredProcedure, &quot;PublishOrders&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an int representing the number of rows affected by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int ExecuteNonQuery(SqlTransaction transaction, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteNonQuery(transaction, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns no resultset) against the specified SqlTransaction&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int result = ExecuteNonQuery(trans, CommandType.StoredProcedure, &quot;GetOrders&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an int representing the number of rows affected by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int ExecuteNonQuery(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //create a command and prepare it for execution&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //finally, execute the command.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int retval = cmd.ExecuteNonQuery();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // detach the SqlParameters from the command object, so they can be used again.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Clear();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return retval;&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns no resultset) against the specified&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// SqlTransaction using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int result = ExecuteNonQuery(conn, trans, &quot;PublishOrders&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an int representing the number of rows affected by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static int ExecuteNonQuery(SqlTransaction transaction, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; //pull the parameters for this stored procedure from the parameter cache (or discover them &amp;amp; populate the cache)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection.ConnectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //assign the provided values to these parameters based on parameter order&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes an array of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteNonQuery(transaction, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteNonQuery(transaction, CommandType.StoredProcedure, spName);&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;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #endregion ExecuteNonQuery&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #region ExecuteDataSet&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the database specified in&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// the connection string.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;DataSet ds = ExecuteDataset(connString, CommandType.StoredProcedure, &quot;GetOrders&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a dataset containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static DataSet ExecuteDataset(string connectionString, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteDataset(connectionString, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset) against the database specified in the connection string&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;DataSet ds = ExecuteDataset(connString, CommandType.StoredProcedure, &quot;GetOrders&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a dataset containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static DataSet ExecuteDataset(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //create &amp;amp; open a SqlConnection, and dispose of it after we are done.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; using (SqlConnection cn = new SqlConnection(connectionString))&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; cn.Open();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes a connection in place of the connection string&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteDataset(cn, commandType, commandText, commandParameters);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// the connection string using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;DataSet ds = ExecuteDataset(connString, &quot;GetOrders&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a dataset containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static DataSet ExecuteDataset(string connectionString, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; //pull the parameters for this stored procedure from the parameter cache (or discover them &amp;amp; populate the cache)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //assign the provided values to these parameters based on parameter order&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes an array of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteDataset(connectionString, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteDataset(connectionString, CommandType.StoredProcedure, spName);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;DataSet ds = ExecuteDataset(conn, CommandType.StoredProcedure, &quot;GetOrders&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a dataset containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static DataSet ExecuteDataset(SqlConnection connection, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteDataset(connection, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset) against the specified SqlConnection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;DataSet ds = ExecuteDataset(conn, CommandType.StoredProcedure, &quot;GetOrders&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a dataset containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static DataSet ExecuteDataset(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //create a command and prepare it for execution&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //create the DataAdapter &amp;amp; DataSet&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; cmd.CommandTimeout = 400;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //fill the DataSet using default values for DataTable names, etc.&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; // detach the SqlParameters from the command object, so they can be used again. &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; cmd.Parameters.Clear();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //return the dataset&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ds;&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;DataSet ds = ExecuteDataset(conn, &quot;GetOrders&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a dataset containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static DataSet ExecuteDataset(SqlConnection connection, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; //pull the parameters for this stored procedure from the parameter cache (or discover them &amp;amp; populate the cache)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection.ConnectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //assign the provided values to these parameters based on parameter order&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes an array of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteDataset(connection, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteDataset(connection, CommandType.StoredProcedure, spName);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;DataSet ds = ExecuteDataset(trans, CommandType.StoredProcedure, &quot;GetOrders&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a dataset containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static DataSet ExecuteDataset(SqlTransaction transaction, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteDataset(transaction, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset) against the specified SqlTransaction&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;DataSet ds = ExecuteDataset(trans, CommandType.StoredProcedure, &quot;GetOrders&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a dataset containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static DataSet ExecuteDataset(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //create a command and prepare it for execution&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //create the DataAdapter &amp;amp; DataSet&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;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //fill the DataSet using default values for DataTable names, etc.&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; // detach the SqlParameters from the command object, so they can be used again.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Clear();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //return the dataset&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ds;&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// SqlTransaction using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;DataSet ds = ExecuteDataset(trans, &quot;GetOrders&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a dataset containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static DataSet ExecuteDataset(SqlTransaction transaction, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; //pull the parameters for this stored procedure from the parameter cache (or discover them &amp;amp; populate the cache)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection.ConnectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //assign the provided values to these parameters based on parameter order&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes an array of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteDataset(transaction, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteDataset(transaction, CommandType.StoredProcedure, spName);&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; #endregion ExecuteDataSet&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #region ExecuteReader&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// this enum is used to indicate whether the connection was provided by the caller, or created by SqlHelper, so that&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// we can set the appropriate CommandBehavior when calling ExecuteReader()&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private enum SqlConnectionOwnership&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; /// &amp;lt;summary&amp;gt;Connection is owned and managed by SqlHelper&amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Internal,&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;Connection is owned and managed by the caller&amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; External&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Create and prepare a SqlCommand, and call ExecuteReader with the appropriate CommandBehavior.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// If we created and opened the connection, we want the connection to be closed when the DataReader is closed.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// If the caller provided the connection, we want to leave it to them to manage.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection, on which to execute this command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction, or &#39;null&#39;&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParameters to be associated with the command or &#39;null&#39; if no parameters are required&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionOwnership&quot;&amp;gt;indicates whether the connection parameter was provided by the caller, or created by SqlHelper&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;SqlDataReader containing the results of the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static SqlDataReader ExecuteReader(SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter[] commandParameters, SqlConnectionOwnership connectionOwnership)&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; //create a command and prepare it for execution&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PrepareCommand(cmd, connection, transaction, commandType, commandText, commandParameters);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //create a reader&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlDataReader dr;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // call ExecuteReader with the appropriate CommandBehavior&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (connectionOwnership == SqlConnectionOwnership.External)&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; dr = cmd.ExecuteReader();&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; dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &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; // detach the SqlParameters from the command object, so they can be used again.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Clear();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return dr;&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the database specified in&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// the connection string.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;SqlDataReader dr = ExecuteReader(connString, CommandType.StoredProcedure, &quot;GetOrders&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a SqlDataReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static SqlDataReader ExecuteReader(string connectionString, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteReader(connectionString, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset) against the database specified in the connection string&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;SqlDataReader dr = ExecuteReader(connString, CommandType.StoredProcedure, &quot;GetOrders&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a SqlDataReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static SqlDataReader ExecuteReader(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //create &amp;amp; open a SqlConnection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlConnection cn = new SqlConnection(connectionString);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cn.Open();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try&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; //call the private overload that takes an internally owned connection in place of the connection string&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteReader(cn, null, commandType, commandText, commandParameters, SqlConnectionOwnership.Internal);&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; catch&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; //if we fail to return the SqlDatReader, we need to close the connection ourselves&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cn.Close();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; throw;&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the database specified in&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// the connection string using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;SqlDataReader dr = ExecuteReader(connString, &quot;GetOrders&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a SqlDataReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static SqlDataReader ExecuteReader(string connectionString, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; //pull the parameters for this stored procedure from the parameter cache (or discover them &amp;amp; populate the cache)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //assign the provided values to these parameters based on parameter order&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes an array of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteReader(connectionString, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteReader(connectionString, CommandType.StoredProcedure, spName);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;SqlDataReader dr = ExecuteReader(conn, CommandType.StoredProcedure, &quot;GetOrders&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a SqlDataReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static SqlDataReader ExecuteReader(SqlConnection connection, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteReader(connection, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset) against the specified SqlConnection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;SqlDataReader dr = ExecuteReader(conn, CommandType.StoredProcedure, &quot;GetOrders&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a SqlDataReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static SqlDataReader ExecuteReader(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //pass through the call to the private overload using a null transaction value and an externally owned connection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteReader(connection, (SqlTransaction)null, commandType, commandText, commandParameters, SqlConnectionOwnership.External);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;SqlDataReader dr = ExecuteReader(conn, &quot;GetOrders&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a SqlDataReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static SqlDataReader ExecuteReader(SqlConnection connection, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection.ConnectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteReader(connection, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteReader(connection, CommandType.StoredProcedure, spName);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;SqlDataReader dr = ExecuteReader(trans, CommandType.StoredProcedure, &quot;GetOrders&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a SqlDataReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static SqlDataReader ExecuteReader(SqlTransaction transaction, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteReader(transaction, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset) against the specified SqlTransaction&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp; SqlDataReader dr = ExecuteReader(trans, CommandType.StoredProcedure, &quot;GetOrders&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a SqlDataReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static SqlDataReader ExecuteReader(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //pass through to private overload, indicating that the connection is owned by the caller&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteReader(transaction.Connection, transaction, commandType, commandText, commandParameters, SqlConnectionOwnership.External);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// SqlTransaction using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;SqlDataReader dr = ExecuteReader(trans, &quot;GetOrders&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a SqlDataReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static SqlDataReader ExecuteReader(SqlTransaction transaction, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection.ConnectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteReader(transaction, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteReader(transaction, CommandType.StoredProcedure, spName);&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; #endregion ExecuteReader&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #region ExecuteScalar&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the database specified in&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// the connection string.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int orderCount = (int)ExecuteScalar(connString, CommandType.StoredProcedure, &quot;GetOrderCount&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an object containing the value in the 1x1 resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static object ExecuteScalar(string connectionString, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteScalar(connectionString, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a 1x1 resultset) against the database specified in the connection string&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int orderCount = (int)ExecuteScalar(connString, CommandType.StoredProcedure, &quot;GetOrderCount&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an object containing the value in the 1x1 resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static object ExecuteScalar(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //create &amp;amp; open a SqlConnection, and dispose of it after we are done.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; using (SqlConnection cn = new SqlConnection(connectionString))&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; cn.Open();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes a connection in place of the connection string&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteScalar(cn, commandType, commandText, commandParameters);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the database specified in&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// the connection string using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int orderCount = (int)ExecuteScalar(connString, &quot;GetOrderCount&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an object containing the value in the 1x1 resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static object ExecuteScalar(string connectionString, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; //pull the parameters for this stored procedure from the parameter cache (or discover them &amp;amp; populate the cache)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //assign the provided values to these parameters based on parameter order&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes an array of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteScalar(connectionString, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteScalar(connectionString, CommandType.StoredProcedure, spName);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the provided SqlConnection.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int orderCount = (int)ExecuteScalar(conn, CommandType.StoredProcedure, &quot;GetOrderCount&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an object containing the value in the 1x1 resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static object ExecuteScalar(SqlConnection connection, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteScalar(connection, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int orderCount = (int)ExecuteScalar(conn, CommandType.StoredProcedure, &quot;GetOrderCount&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an object containing the value in the 1x1 resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static object ExecuteScalar(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //create a command and prepare it for execution&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //execute the command &amp;amp; return the results&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; object retval = cmd.ExecuteScalar();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // detach the SqlParameters from the command object, so they can be used again.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Clear();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return retval;&lt;br /&gt;
&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int orderCount = (int)ExecuteScalar(conn, &quot;GetOrderCount&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an object containing the value in the 1x1 resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static object ExecuteScalar(SqlConnection connection, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; //pull the parameters for this stored procedure from the parameter cache (or discover them &amp;amp; populate the cache)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection.ConnectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //assign the provided values to these parameters based on parameter order&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes an array of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteScalar(connection, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteScalar(connection, CommandType.StoredProcedure, spName);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a 1x1 resultset and takes no parameters) against the provided SqlTransaction.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int orderCount = (int)ExecuteScalar(trans, CommandType.StoredProcedure, &quot;GetOrderCount&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an object containing the value in the 1x1 resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static object ExecuteScalar(SqlTransaction transaction, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteScalar(transaction, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a 1x1 resultset) against the specified SqlTransaction&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int orderCount = (int)ExecuteScalar(trans, CommandType.StoredProcedure, &quot;GetOrderCount&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an object containing the value in the 1x1 resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static object ExecuteScalar(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //create a command and prepare it for execution&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //execute the command &amp;amp; return the results&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; object retval = cmd.ExecuteScalar();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // detach the SqlParameters from the command object, so they can be used again.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Clear();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return retval;&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns a 1x1 resultset) against the specified&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// SqlTransaction using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;int orderCount = (int)ExecuteScalar(trans, &quot;GetOrderCount&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an object containing the value in the 1x1 resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static object ExecuteScalar(SqlTransaction transaction, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; //pull the parameters for this stored procedure from the parameter cache (or discover them &amp;amp; populate the cache)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection.ConnectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //assign the provided values to these parameters based on parameter order&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes an array of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteScalar(transaction, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteScalar(transaction, CommandType.StoredProcedure, spName);&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; #endregion ExecuteScalar&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #region ExecuteXmlReader&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlConnection.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;XmlReader r = ExecuteXmlReader(conn, CommandType.StoredProcedure, &quot;GetOrders&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command using &quot;FOR XML AUTO&quot;&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an XmlReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static XmlReader ExecuteXmlReader(SqlConnection connection, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteXmlReader(connection, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset) against the specified SqlConnection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;XmlReader r = ExecuteXmlReader(conn, CommandType.StoredProcedure, &quot;GetOrders&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command using &quot;FOR XML AUTO&quot;&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an XmlReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static XmlReader ExecuteXmlReader(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //create a command and prepare it for execution&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //create the DataAdapter &amp;amp; DataSet&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XmlReader retval = cmd.ExecuteXmlReader();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // detach the SqlParameters from the command object, so they can be used again.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Clear();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return retval;&lt;br /&gt;
&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified SqlConnection&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;XmlReader r = ExecuteXmlReader(conn, &quot;GetOrders&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connection&quot;&amp;gt;a valid SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure using &quot;FOR XML AUTO&quot;&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an XmlReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static XmlReader ExecuteXmlReader(SqlConnection connection, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; //pull the parameters for this stored procedure from the parameter cache (or discover them &amp;amp; populate the cache)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connection.ConnectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //assign the provided values to these parameters based on parameter order&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes an array of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteXmlReader(connection, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteXmlReader(connection, CommandType.StoredProcedure, spName);&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; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset and takes no parameters) against the provided SqlTransaction.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;XmlReader r = ExecuteXmlReader(trans, CommandType.StoredProcedure, &quot;GetOrders&quot;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command using &quot;FOR XML AUTO&quot;&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an XmlReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static XmlReader ExecuteXmlReader(SqlTransaction transaction, CommandType commandType, string commandText)&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; //pass through the call providing null for the set of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteXmlReader(transaction, commandType, commandText, (SqlParameter[])null);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a SqlCommand (that returns a resultset) against the specified SqlTransaction&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// using the provided parameters.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;XmlReader r = ExecuteXmlReader(trans, CommandType.StoredProcedure, &quot;GetOrders&quot;, new SqlParameter(&quot;@prodid&quot;, 24));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandType&quot;&amp;gt;the CommandType (stored procedure, text, etc.)&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command using &quot;FOR XML AUTO&quot;&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters used to execute the command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an XmlReader containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static XmlReader ExecuteXmlReader(SqlTransaction transaction, CommandType commandType, string commandText, params SqlParameter[] commandParameters)&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; //create a command and prepare it for execution&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommand cmd = new SqlCommand();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; PrepareCommand(cmd, transaction.Connection, transaction, commandType, commandText, commandParameters);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //create the DataAdapter &amp;amp; DataSet&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XmlReader retval = cmd.ExecuteXmlReader();&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // detach the SqlParameters from the command object, so they can be used again.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.Clear();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return retval;&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Execute a stored procedure via a SqlCommand (that returns a resultset) against the specified&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// SqlTransaction using the provided parameter values. &amp;nbsp;This method will query the database to discover the parameters for the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method provides no access to output parameters or the stored procedure&#39;s return value parameter.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ///&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// e.g.: &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;nbsp;XmlReader r = ExecuteXmlReader(trans, &quot;GetOrders&quot;, 24, 36);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;transaction&quot;&amp;gt;a valid SqlTransaction&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;parameterValues&quot;&amp;gt;an array of objects to be assigned as the input values of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;a dataset containing the resultset generated by the command&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static XmlReader ExecuteXmlReader(SqlTransaction transaction, string spName, params object[] parameterValues)&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 we receive parameter values, we need to figure out where they go&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if ((parameterValues != null) &amp;amp;&amp;amp; (parameterValues.Length &amp;gt; 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; //pull the parameters for this stored procedure from the parameter cache (or discover them &amp;amp; populate the cache)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(transaction.Connection.ConnectionString, spName);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //assign the provided values to these parameters based on parameter order&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; AssignParameterValues(commandParameters, parameterValues);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //call the overload that takes an array of SqlParameters&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ExecuteXmlReader(transaction, CommandType.StoredProcedure, spName, commandParameters);&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; //otherwise we can just call the SP without params&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; return ExecuteXmlReader(transaction, CommandType.StoredProcedure, spName);&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;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #endregion ExecuteXmlReader&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; /// SqlHelperParameterCache provides functions to leverage a static cache of procedure parameters, and the&lt;br /&gt;
&amp;nbsp; &amp;nbsp; /// ability to discover parameters for stored procedures at run-time.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; public sealed class SqlHelperParameterCache&lt;br /&gt;
&amp;nbsp; &amp;nbsp; {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #region private methods, variables, and constructors&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //Since this class provides only static methods, make the default constructor private to prevent&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //instances from being created with &quot;new SqlHelperParameterCache()&quot;.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private SqlHelperParameterCache() { }&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static Hashtable paramCache = Hashtable.Synchronized(new Hashtable());&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// resolve at run time the appropriate set of SqlParameters for a stored procedure&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;includeReturnValueParameter&quot;&amp;gt;whether or not to include their return value parameter&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static SqlParameter[] DiscoverSpParameterSet(string connectionString, string spName, bool includeReturnValueParameter)&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; using (SqlConnection cn = new SqlConnection(connectionString))&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; using (SqlCommand cmd = new SqlCommand(spName, cn))&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; cn.Open();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.CommandType = CommandType.StoredProcedure;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlCommandBuilder.DeriveParameters(cmd);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!includeReturnValueParameter)&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; cmd.Parameters.RemoveAt(0);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &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; &amp;nbsp; &amp;nbsp; SqlParameter[] discoveredParameters = new SqlParameter[cmd.Parameters.Count]; ;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cmd.Parameters.CopyTo(discoveredParameters, 0);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return discoveredParameters;&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; //deep copy of cached SqlParameter array&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private static SqlParameter[] CloneParameters(SqlParameter[] originalParameters)&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; SqlParameter[] clonedParameters = new SqlParameter[originalParameters.Length];&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int i = 0, j = originalParameters.Length; i &amp;lt; j; i++)&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; clonedParameters[i] = (SqlParameter)((ICloneable)originalParameters[i]).Clone();&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &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; return clonedParameters;&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; #endregion private methods, variables, and constructors&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #region caching functions&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// add parameter array to the cache&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandParameters&quot;&amp;gt;an array of SqlParamters to be cached&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static void CacheParameterSet(string connectionString, string commandText, params SqlParameter[] commandParameters)&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; string hashKey = connectionString + &quot;:&quot; + commandText;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; paramCache[hashKey] = commandParameters;&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// retrieve a parameter array from the cache&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;commandText&quot;&amp;gt;the stored procedure name or T-SQL command&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an array of SqlParamters&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static SqlParameter[] GetCachedParameterSet(string connectionString, string commandText)&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; string hashKey = connectionString + &quot;:&quot; + commandText;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] cachedParameters = (SqlParameter[])paramCache[hashKey];&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (cachedParameters == 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; return 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; 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; return CloneParameters(cachedParameters);&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; #endregion caching functions&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; #region Parameter Discovery Functions&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Retrieves the set of SqlParameters appropriate for the stored procedure&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method will query the database for this information, and then store it in a cache for future requests.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an array of SqlParameters&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static SqlParameter[] GetSpParameterSet(string connectionString, string spName)&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; return GetSpParameterSet(connectionString, spName, false);&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;lt;summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// Retrieves the set of SqlParameters appropriate for the stored procedure&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/summary&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// This method will query the database for this information, and then store it in a cache for future requests.&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;/remarks&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;connectionString&quot;&amp;gt;a valid connection string for a SqlConnection&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;spName&quot;&amp;gt;the name of the stored procedure&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;param name=&quot;includeReturnValueParameter&quot;&amp;gt;a bool value indicating whether the return value parameter should be included in the results&amp;lt;/param&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; /// &amp;lt;returns&amp;gt;an array of SqlParameters&amp;lt;/returns&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public static SqlParameter[] GetSpParameterSet(string connectionString, string spName, bool includeReturnValueParameter)&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; string hashKey = connectionString + &quot;:&quot; + spName + (includeReturnValueParameter ? &quot;:include ReturnValue Parameter&quot; : &quot;&quot;);&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SqlParameter[] cachedParameters;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cachedParameters = (SqlParameter[])paramCache[hashKey];&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (cachedParameters == 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; cachedParameters = (SqlParameter[])(paramCache[hashKey] = DiscoverSpParameterSet(connectionString, spName, includeReturnValueParameter));&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &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; return CloneParameters(cachedParameters);&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; #endregion Parameter Discovery Functions&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; }&lt;br /&gt;
}&lt;br /&gt;
&lt;pre class=&quot;csharpcode&quot; style=&quot;background-color: white; font-family: Consolas, &#39;Courier New&#39;, Courier, monospace; font-size: small;&quot;&gt;&lt;/pre&gt;
&lt;h2 style=&quot;text-align: left;&quot;&gt;
   &amp;nbsp;You Can &amp;nbsp;&lt;a href=&quot;https://docs.google.com/file/d/0B3cX9PKsnrffclBJWDJXa0YyM28/edit?usp=sharing&quot; target=&quot;_blank&quot;&gt;DownloadFile&lt;/a&gt;&amp;nbsp; From Here.&lt;/h2&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/3533056737479340130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2013/02/sqlhelpercs-source-code.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/3533056737479340130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/3533056737479340130'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2013/02/sqlhelpercs-source-code.html' title='sqlhelper.cs source code..'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-4739070126331430536</id><published>2013-02-16T03:08:00.001-08:00</published><updated>2013-02-16T03:08:30.479-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server 2008"/><title type='text'>get the 4 th maximum salary from a table without using any sql keyword (TOP,MAX are mot allowed)</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
select ename,Salary from Emp a group by Ename,Salary&lt;br /&gt;
&amp;nbsp; &amp;nbsp;having 4=(select COUNT(distinct( salary) )from Emp b where a.salary&amp;lt;=b.Salary)&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/4739070126331430536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2013/02/get-4-th-maximum-salary-from-table.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/4739070126331430536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/4739070126331430536'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2013/02/get-4-th-maximum-salary-from-table.html' title='get the 4 th maximum salary from a table without using any sql keyword (TOP,MAX are mot allowed)'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-1254283982838742945</id><published>2013-01-02T21:58:00.001-08:00</published><updated>2013-01-02T21:58:43.987-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="windows 7"/><title type='text'>Hide (this copy of windows is not genuine) notification in windows 7</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
with some easy step you can hide this notification form your desktop. so lets start........&lt;br /&gt;
&lt;br /&gt;
Uninstalling Windows Update: KB971033&lt;br /&gt;
Go to Windows Update&lt;br /&gt;
Hit Installed Updates (link at the bottom left corner). If that link isn’t there, hit “view update history” and hit the “installed updates” link at the top.&lt;br /&gt;
Scroll down to the section titled “Microsoft Windows” and look for update KB971033.&lt;br /&gt;
Right click it and hit “uninstall”. Hit okay.&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/AVvXsEgqalY6QDfg3q2oI8og7NtQe7dLoDtSm_kaqD1wFjxMeXCWZ4O-EzYe0Vtn4nYhO6aiWuH9IHuITL6oc_THLMe10fEmM7MVwwrBnytiNaczoCwnz1Li07wEHKUaHTOgMAGymdt66uONHqA/s1600/kk.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;179&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqalY6QDfg3q2oI8og7NtQe7dLoDtSm_kaqD1wFjxMeXCWZ4O-EzYe0Vtn4nYhO6aiWuH9IHuITL6oc_THLMe10fEmM7MVwwrBnytiNaczoCwnz1Li07wEHKUaHTOgMAGymdt66uONHqA/s320/kk.jpg&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
Reboot now.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
after the reboot&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
1 Click start and simply type COMMAND PR in the start menu’s search box. Right click COMMAND PROMPT and select RUN AS ADMINISTRATOR.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;2. &amp;nbsp; In the command prompt window type:&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
slmgr.vbs -rearm&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;and press enter. (Note that there is a space between slmgr.vbs and -rearm.)&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&amp;nbsp;3. &amp;nbsp;Now reboot and you&#39;re good to go.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
This method is tested by me and a lot of other people(see comments) and it is working fine.&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
If you got stuck anywhere refer to comments. Comments act as a good troubleshooter.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
Your queries are appreciated. Feel free to post comments.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/1254283982838742945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2013/01/hide-this-copy-of-windows-is-not.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/1254283982838742945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/1254283982838742945'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2013/01/hide-this-copy-of-windows-is-not.html' title='Hide (this copy of windows is not genuine) notification in windows 7'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqalY6QDfg3q2oI8og7NtQe7dLoDtSm_kaqD1wFjxMeXCWZ4O-EzYe0Vtn4nYhO6aiWuH9IHuITL6oc_THLMe10fEmM7MVwwrBnytiNaczoCwnz1Li07wEHKUaHTOgMAGymdt66uONHqA/s72-c/kk.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-6268012796558793332</id><published>2012-11-26T01:59:00.001-08:00</published><updated>2012-11-26T01:59:57.460-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Samsung Omnia w"/><title type='text'>How To Change Your Picture Tile Image And Your Picture Hub Background Image</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
The following steps will give you the opportunity to change your Picture Tile image and the background image in your Picture Hub.&lt;br /&gt;
1 &amp;nbsp;Home screen&lt;br /&gt;
2 &amp;nbsp;Select Pictures&lt;br /&gt;
3 &amp;nbsp;Under the Title “Pictures” &amp;nbsp;Tap and Hold&lt;br /&gt;
4 &amp;nbsp;A menu pops up and select ‘Change background”&lt;br /&gt;
5 &amp;nbsp;Select a images in one of your your albums&lt;br /&gt;
6 &amp;nbsp;Move the image around within the given frame.&lt;br /&gt;
7 &amp;nbsp;Select the “v” check mark&lt;br /&gt;
8 &amp;nbsp;Now your Picture Hub background image has been changed as well as your Picture Tile on the home screen.&lt;br /&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/6268012796558793332/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2012/11/how-to-change-your-picture-tile-image.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/6268012796558793332'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/6268012796558793332'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2012/11/how-to-change-your-picture-tile-image.html' title='How To Change Your Picture Tile Image And Your Picture Hub Background Image'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3847585507953566840.post-3157940393228432225</id><published>2012-11-26T01:55:00.003-08:00</published><updated>2012-11-26T01:55:45.927-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Samsung Omnia w"/><title type='text'>How To Use Windows Phone 7 Device As Portable USB Flash Drive</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div&gt;
1 &amp;nbsp;From your PC go to the start menu and in the search area type regedit. This will open the registry editor.&lt;/div&gt;
&lt;div&gt;
2 &amp;nbsp;In the bar located on the left of the editor navigate to the given path&lt;/div&gt;
&lt;div&gt;
&amp;nbsp; &amp;nbsp; HKEY_LOCAL_MACHINE –&amp;gt; SYSTEM –&amp;gt; CurrentControlSet –&amp;gt; Enum –&amp;gt; USB&lt;/div&gt;
&lt;div&gt;
3 &amp;nbsp;This will give you a long list in your side bar. Select the USB folder you have just reached but don’t do anything else yet.&lt;/div&gt;
&lt;div&gt;
4 &amp;nbsp;Hit Ctrl+F, which will open the Find dialog box. Input ZuneDriver and enter. This will automatically bring you to the WUDF folder.&lt;/div&gt;
&lt;div&gt;
5 &amp;nbsp;Select the folder just above WUDF, named Device Parameters, opening a number of entries in the main screen on the right.&lt;/div&gt;
&lt;div&gt;
6 &amp;nbsp;Among the many entries look for “ShowInShell”, double click and change the value from 0 to 1.&lt;/div&gt;
&lt;div&gt;
7 &amp;nbsp;The registry value marked as “PortableDeviceNameSpaceExcludeFromShell” goes to 1 from the default 0&lt;/div&gt;
&lt;div&gt;
8 &amp;nbsp;Set “EnableLegacySupport” to 1.&lt;/div&gt;
&lt;div&gt;
9 &amp;nbsp;Exit registry editor.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
guys hope it&#39;ll help you.......&lt;/div&gt;
&lt;div&gt;
please comment me if it helped you.......&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://krishankayat.blogspot.com/feeds/3157940393228432225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://krishankayat.blogspot.com/2012/11/how-to-use-windows-phone-7-device-as.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/3157940393228432225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3847585507953566840/posts/default/3157940393228432225'/><link rel='alternate' type='text/html' href='http://krishankayat.blogspot.com/2012/11/how-to-use-windows-phone-7-device-as.html' title='How To Use Windows Phone 7 Device As Portable USB Flash Drive'/><author><name>krishan kumar</name><uri>http://www.blogger.com/profile/13957256457271367502</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>