<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CkAGQnY5fSp7ImA9WhRVEEk.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646</id><updated>2012-01-08T22:08:43.825+05:30</updated><title>Harindaka's Home</title><subtitle type="html">There are 10 kinds of people in the world, those who understand binary and those who don't...</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://harindaka.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>40</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/harindaka" /><feedburner:info uri="harindaka" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><link rel="license" type="text/html" href="http://creativecommons.org/licenses/by-sa/2.0/" /><feedburner:emailServiceId>harindaka</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><entry gd:etag="W/&quot;DkAARH06cCp7ImA9WhRSFk4.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-9051983663454653661</id><published>2011-11-17T22:51:00.001+05:30</published><updated>2011-11-18T22:15:45.318+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-18T22:15:45.318+05:30</app:edited><title>Sharing with C#: Creating, Deleting, Listing and Managing Permissions of Windows Shares Using C#</title><content type="html">&lt;p&gt;Having to write a piece of code for the above task made me realize how rare such code samples are on the internet. Hence I do hope this saves someone else a whole lot of effort. The following class will let you create, delete and list windows shares. It will also allow you to access share properties such as description, maximum allowed user count etc. You’ll even be able to set share permissions. So select the code and hit that Ctrl + C now &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-openmouthedsmile" alt="Open-mouthed smile" src="http://lh6.ggpht.com/-6UqWpYyZvkA/TsVCfPd4ctI/AAAAAAAAAZY/GBDx6i0YnPU/wlEmoticon-openmouthedsmile%25255B2%25255D.png?imgmax=800" /&gt;&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Management;&lt;br /&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Security.Principal;&lt;br /&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;&lt;br /&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;Test&lt;br /&gt;{&lt;br /&gt;    &lt;span style="color: blue"&gt;internal class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WindowsShare&lt;br /&gt;    &lt;/span&gt;{&lt;br /&gt;        &lt;span style="color: blue"&gt;public enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MethodStatus &lt;/span&gt;: &lt;span style="color: blue"&gt;uint&lt;br /&gt;        &lt;/span&gt;{&lt;br /&gt;            Success = 0,     &lt;span style="color: green"&gt;//Success&lt;br /&gt;            &lt;/span&gt;AccessDenied = 2,     &lt;span style="color: green"&gt;//Access denied&lt;br /&gt;            &lt;/span&gt;UnknownFailure = 8,     &lt;span style="color: green"&gt;//Unknown failure&lt;br /&gt;            &lt;/span&gt;InvalidName = 9,     &lt;span style="color: green"&gt;//Invalid name&lt;br /&gt;            &lt;/span&gt;InvalidLevel = 10,     &lt;span style="color: green"&gt;//Invalid level&lt;br /&gt;            &lt;/span&gt;InvalidParameter = 21,     &lt;span style="color: green"&gt;//Invalid parameter&lt;br /&gt;            &lt;/span&gt;DuplicateShare = 22,     &lt;span style="color: green"&gt;//Duplicate share&lt;br /&gt;            &lt;/span&gt;RedirectedPath = 23,     &lt;span style="color: green"&gt;//Redirected path&lt;br /&gt;            &lt;/span&gt;UnknownDevice = 24,     &lt;span style="color: green"&gt;//Unknown device or directory&lt;br /&gt;            &lt;/span&gt;NetNameNotFound = 25     &lt;span style="color: green"&gt;//Net name not found&lt;br /&gt;        &lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ShareType &lt;/span&gt;: &lt;span style="color: blue"&gt;uint&lt;br /&gt;        &lt;/span&gt;{&lt;br /&gt;            DiskDrive = 0x0,     &lt;span style="color: green"&gt;//Disk Drive&lt;br /&gt;            &lt;/span&gt;PrintQueue = 0x1,     &lt;span style="color: green"&gt;//Print Queue&lt;br /&gt;            &lt;/span&gt;Device = 0x2,     &lt;span style="color: green"&gt;//Device&lt;br /&gt;            &lt;/span&gt;IPC = 0x3,     &lt;span style="color: green"&gt;//IPC&lt;br /&gt;            &lt;/span&gt;DiskDriveAdmin = 0x80000000,     &lt;span style="color: green"&gt;//Disk Drive Admin&lt;br /&gt;            &lt;/span&gt;PrintQueueAdmin = 0x80000001,     &lt;span style="color: green"&gt;//Print Queue Admin&lt;br /&gt;            &lt;/span&gt;DeviceAdmin = 0x80000002,     &lt;span style="color: green"&gt;//Device Admin&lt;br /&gt;            &lt;/span&gt;IpcAdmin = 0x80000003     &lt;span style="color: green"&gt;//IPC Admin&lt;br /&gt;        &lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;AccessMaskTypes&lt;br /&gt;        &lt;/span&gt;{&lt;br /&gt;            FullControl = 2032127,&lt;br /&gt;            Change = 1245631,&lt;br /&gt;            ReadOnly = 1179817&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManagementObject &lt;/span&gt;_winShareObject;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;private &lt;/span&gt;WindowsShare(&lt;span style="color: #2b91af"&gt;ManagementObject &lt;/span&gt;obj)&lt;br /&gt;        {&lt;br /&gt;            _winShareObject = obj;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManagementObject &lt;/span&gt;ManagementObject&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;_winShareObject; }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public uint &lt;/span&gt;AccessMask&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToUInt32(_winShareObject[&lt;span style="color: #a31515"&gt;&amp;quot;AccessMask&amp;quot;&lt;/span&gt;]); }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public bool &lt;/span&gt;AllowMaximum&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToBoolean(_winShareObject[&lt;span style="color: #a31515"&gt;&amp;quot;AllowMaximum&amp;quot;&lt;/span&gt;]); }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public string &lt;/span&gt;Caption&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToString(_winShareObject[&lt;span style="color: #a31515"&gt;&amp;quot;Caption&amp;quot;&lt;/span&gt;]); }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public string &lt;/span&gt;Description&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToString(_winShareObject[&lt;span style="color: #a31515"&gt;&amp;quot;Description&amp;quot;&lt;/span&gt;]); }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DateTime &lt;/span&gt;InstallDate&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToDateTime(_winShareObject[&lt;span style="color: #a31515"&gt;&amp;quot;InstallDate&amp;quot;&lt;/span&gt;]); }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public uint &lt;/span&gt;MaximumAllowed&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToUInt32(_winShareObject[&lt;span style="color: #a31515"&gt;&amp;quot;MaximumAllowed&amp;quot;&lt;/span&gt;]); }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public string &lt;/span&gt;Name&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToString(_winShareObject[&lt;span style="color: #a31515"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;]); }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public string &lt;/span&gt;Path&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToString(_winShareObject[&lt;span style="color: #a31515"&gt;&amp;quot;Path&amp;quot;&lt;/span&gt;]); }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public string &lt;/span&gt;Status&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToString(_winShareObject[&lt;span style="color: #a31515"&gt;&amp;quot;Status&amp;quot;&lt;/span&gt;]); }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ShareType &lt;/span&gt;Type&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ShareType&lt;/span&gt;)&lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToUInt32(_winShareObject[&lt;span style="color: #a31515"&gt;&amp;quot;Type&amp;quot;&lt;/span&gt;]); }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MethodStatus &lt;/span&gt;Delete()&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: blue"&gt;object &lt;/span&gt;result = _winShareObject.InvokeMethod(&lt;span style="color: #a31515"&gt;&amp;quot;Delete&amp;quot;&lt;/span&gt;, &lt;span style="color: blue"&gt;new object&lt;/span&gt;[] { });&lt;br /&gt;            &lt;span style="color: blue"&gt;uint &lt;/span&gt;r = &lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToUInt32(result);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue"&gt;return &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;MethodStatus&lt;/span&gt;)r;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MethodStatus &lt;/span&gt;Create(&lt;span style="color: blue"&gt;string &lt;/span&gt;path, &lt;span style="color: blue"&gt;string &lt;/span&gt;name, &lt;span style="color: #2b91af"&gt;ShareType &lt;/span&gt;type, &lt;span style="color: blue"&gt;uint&lt;/span&gt;? maximumAllowed, &lt;span style="color: blue"&gt;string &lt;/span&gt;description, &lt;span style="color: blue"&gt;string &lt;/span&gt;password)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;ManagementClass &lt;/span&gt;mc = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManagementClass&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;Win32_Share&amp;quot;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;ManagementBaseObject &lt;/span&gt;shareParams = mc.GetMethodParameters(&lt;span style="color: #a31515"&gt;&amp;quot;Create&amp;quot;&lt;/span&gt;);&lt;br /&gt;            shareParams[&lt;span style="color: #a31515"&gt;&amp;quot;Path&amp;quot;&lt;/span&gt;] = path;&lt;br /&gt;            shareParams[&lt;span style="color: #a31515"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;] = name;&lt;br /&gt;            shareParams[&lt;span style="color: #a31515"&gt;&amp;quot;Type&amp;quot;&lt;/span&gt;] = (&lt;span style="color: blue"&gt;uint&lt;/span&gt;)type;&lt;br /&gt;            shareParams[&lt;span style="color: #a31515"&gt;&amp;quot;Description&amp;quot;&lt;/span&gt;] = description;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue"&gt;if &lt;/span&gt;(maximumAllowed != &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;br /&gt;                shareParams[&lt;span style="color: #a31515"&gt;&amp;quot;MaximumAllowed&amp;quot;&lt;/span&gt;] = maximumAllowed;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue"&gt;if &lt;/span&gt;(!&lt;span style="color: #2b91af"&gt;String&lt;/span&gt;.IsNullOrEmpty(password))&lt;br /&gt;                shareParams[&lt;span style="color: #a31515"&gt;&amp;quot;Password&amp;quot;&lt;/span&gt;] = password;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;ManagementBaseObject &lt;/span&gt;result = mc.InvokeMethod(&lt;span style="color: #a31515"&gt;&amp;quot;Create&amp;quot;&lt;/span&gt;, shareParams, &lt;span style="color: blue"&gt;null&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue"&gt;return &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;MethodStatus&lt;/span&gt;)(result.Properties[&lt;span style="color: #a31515"&gt;&amp;quot;ReturnValue&amp;quot;&lt;/span&gt;].Value);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;WindowsShare&lt;/span&gt;&amp;gt; GetAllShares()&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;WindowsShare&lt;/span&gt;&amp;gt; result = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;WindowsShare&lt;/span&gt;&amp;gt;();&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;ManagementClass &lt;/span&gt;mc = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManagementClass&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;Win32_Share&amp;quot;&lt;/span&gt;);&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;ManagementObjectCollection &lt;/span&gt;moc = mc.GetInstances();&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ManagementObject &lt;/span&gt;mo &lt;span style="color: blue"&gt;in &lt;/span&gt;moc)&lt;br /&gt;            {&lt;br /&gt;                &lt;span style="color: #2b91af"&gt;WindowsShare &lt;/span&gt;share = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WindowsShare&lt;/span&gt;(mo);&lt;br /&gt;                result.Add(share);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue"&gt;return &lt;/span&gt;result;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WindowsShare &lt;/span&gt;GetShareByName(&lt;span style="color: blue"&gt;string &lt;/span&gt;name)&lt;br /&gt;        {&lt;br /&gt;            name = name.ToUpper();&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;WindowsShare&lt;/span&gt;&amp;gt; shares = GetAllShares();&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;WindowsShare &lt;/span&gt;s &lt;span style="color: blue"&gt;in &lt;/span&gt;shares)&lt;br /&gt;                &lt;span style="color: blue"&gt;if &lt;/span&gt;(s.Name.ToUpper() == name)&lt;br /&gt;                    &lt;span style="color: blue"&gt;return &lt;/span&gt;s;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue"&gt;return null&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WindowsShare &lt;/span&gt;GetShareByPath(&lt;span style="color: blue"&gt;string &lt;/span&gt;path)&lt;br /&gt;        {&lt;br /&gt;            path = path.ToUpper();&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;IList&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;WindowsShare&lt;/span&gt;&amp;gt; shares = GetAllShares();&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;WindowsShare &lt;/span&gt;s &lt;span style="color: blue"&gt;in &lt;/span&gt;shares)&lt;br /&gt;                &lt;span style="color: blue"&gt;if &lt;/span&gt;(s.Path.ToUpper() == path)&lt;br /&gt;                    &lt;span style="color: blue"&gt;return &lt;/span&gt;s;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue"&gt;return null&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MethodStatus &lt;/span&gt;SetPermission(&lt;span style="color: blue"&gt;string &lt;/span&gt;domain, &lt;span style="color: blue"&gt;string &lt;/span&gt;userName, &lt;span style="color: #2b91af"&gt;AccessMaskTypes &lt;/span&gt;amtype)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;NTAccount &lt;/span&gt;account = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;NTAccount&lt;/span&gt;(domain, userName);&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;SecurityIdentifier &lt;/span&gt;sid = (&lt;span style="color: #2b91af"&gt;SecurityIdentifier&lt;/span&gt;)account.Translate(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;SecurityIdentifier&lt;/span&gt;));&lt;br /&gt;            &lt;span style="color: blue"&gt;byte&lt;/span&gt;[] sidArray = &lt;span style="color: blue"&gt;new byte&lt;/span&gt;[sid.BinaryLength];&lt;br /&gt;            sid.GetBinaryForm(sidArray, 0);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;ManagementObject &lt;/span&gt;trustee = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManagementClass&lt;/span&gt;(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManagementPath&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;Win32_Trustee&amp;quot;&lt;/span&gt;), &lt;span style="color: blue"&gt;null&lt;/span&gt;);&lt;br /&gt;            trustee[&lt;span style="color: #a31515"&gt;&amp;quot;Domain&amp;quot;&lt;/span&gt;] = domain;&lt;br /&gt;            trustee[&lt;span style="color: #a31515"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;] = userName;&lt;br /&gt;            trustee[&lt;span style="color: #a31515"&gt;&amp;quot;SID&amp;quot;&lt;/span&gt;] = sidArray;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;ManagementObject &lt;/span&gt;adminACE = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManagementClass&lt;/span&gt;(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManagementPath&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;Win32_Ace&amp;quot;&lt;/span&gt;), &lt;span style="color: blue"&gt;null&lt;/span&gt;);&lt;br /&gt;            adminACE[&lt;span style="color: #a31515"&gt;&amp;quot;AccessMask&amp;quot;&lt;/span&gt;] = (&lt;span style="color: blue"&gt;int&lt;/span&gt;)amtype;&lt;br /&gt;            adminACE[&lt;span style="color: #a31515"&gt;&amp;quot;AceFlags&amp;quot;&lt;/span&gt;] = 3;&lt;br /&gt;            adminACE[&lt;span style="color: #a31515"&gt;&amp;quot;AceType&amp;quot;&lt;/span&gt;] = 0;&lt;br /&gt;            adminACE[&lt;span style="color: #a31515"&gt;&amp;quot;Trustee&amp;quot;&lt;/span&gt;] = trustee;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: #2b91af"&gt;ManagementObject &lt;/span&gt;secDescriptor = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManagementClass&lt;/span&gt;(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManagementPath&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;Win32_SecurityDescriptor&amp;quot;&lt;/span&gt;), &lt;span style="color: blue"&gt;null&lt;/span&gt;);&lt;br /&gt;            secDescriptor[&lt;span style="color: #a31515"&gt;&amp;quot;ControlFlags&amp;quot;&lt;/span&gt;] = 4; &lt;span style="color: green"&gt;//SE_DACL_PRESENT &lt;br /&gt;            &lt;/span&gt;secDescriptor[&lt;span style="color: #a31515"&gt;&amp;quot;DACL&amp;quot;&lt;/span&gt;] = &lt;span style="color: blue"&gt;new object&lt;/span&gt;[] { adminACE };&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue"&gt;object &lt;/span&gt;result = _winShareObject.InvokeMethod(&lt;span style="color: #a31515"&gt;&amp;quot;SetShareInfo&amp;quot;&lt;/span&gt;, &lt;span style="color: blue"&gt;new object&lt;/span&gt;[] { &lt;span style="color: #2b91af"&gt;Int32&lt;/span&gt;.MaxValue, &lt;span style="color: blue"&gt;this&lt;/span&gt;.Description, secDescriptor });&lt;br /&gt;            &lt;span style="color: blue"&gt;uint &lt;/span&gt;r = &lt;span style="color: #2b91af"&gt;Convert&lt;/span&gt;.ToUInt32(result);&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue"&gt;return &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;MethodStatus&lt;/span&gt;)r;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;style type="text/css"&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;	font-size: small;&lt;br /&gt;	color: black;&lt;br /&gt;	font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt;	background-color: #ffffff;&lt;br /&gt;	/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;	background-color: #f4f4f4;&lt;br /&gt;	width: 100%;&lt;br /&gt;	margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-9051983663454653661?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=S6fGGbJfc3w:-0HJ9thTQ2g:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=S6fGGbJfc3w:-0HJ9thTQ2g:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=S6fGGbJfc3w:-0HJ9thTQ2g:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=S6fGGbJfc3w:-0HJ9thTQ2g:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=S6fGGbJfc3w:-0HJ9thTQ2g:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=S6fGGbJfc3w:-0HJ9thTQ2g:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=S6fGGbJfc3w:-0HJ9thTQ2g:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=S6fGGbJfc3w:-0HJ9thTQ2g:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=S6fGGbJfc3w:-0HJ9thTQ2g:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/S6fGGbJfc3w" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/9051983663454653661/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=9051983663454653661" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/9051983663454653661?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/9051983663454653661?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/S6fGGbJfc3w/having-to-write-piece-of-code-for-above.html" title="Sharing with C#: Creating, Deleting, Listing and Managing Permissions of Windows Shares Using C#" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-6UqWpYyZvkA/TsVCfPd4ctI/AAAAAAAAAZY/GBDx6i0YnPU/s72-c/wlEmoticon-openmouthedsmile%25255B2%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2011/11/having-to-write-piece-of-code-for-above.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcMR3w6eCp7ImA9WhdVGUg.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-6098858442738491854</id><published>2011-09-25T16:58:00.001+05:30</published><updated>2011-09-25T16:58:06.210+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-25T16:58:06.210+05:30</app:edited><title>ASPTokenInput: Facebook Style Token Based Autocomplete Control for ASP.Net</title><content type="html">&lt;p&gt;Lately I was messing around with a wonderful JQuery plugin called &lt;a href="https://github.com/loopj/jquery-tokeninput" target="_blank"&gt;tokeninput&lt;/a&gt; which provided facebook style autocompletion and token based input. However I was disappointed to find out that there was no way to persist the selected tokens across postbacks. Hence I decided to build an ASP.Net Server Control which worked on top of the JQuery plugin providing postback persistance, server side functionality and events. The end result was an opensource project titled &lt;a href="https://github.com/harindaka/ASPTokenInput/wiki" target="_blank"&gt;ASPTokenInput&lt;/a&gt; hosted in &lt;a href="https://github.com/harindaka/ASPTokenInput/wiki" target="_blank"&gt;Github&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/-QchPoHNf3bc/Tn8QMebM6PI/AAAAAAAAAZI/NVVMr_yE3q0/s1600-h/687474703a2f2f6c6f6f706a2e636f6d2f6a71756572792d746f6b656e696e7075742f66616365626f6f6b2d7374796c652e706e67%25255B5%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="687474703a2f2f6c6f6f706a2e636f6d2f6a71756572792d746f6b656e696e7075742f66616365626f6f6b2d7374796c652e706e67" border="0" alt="687474703a2f2f6c6f6f706a2e636f6d2f6a71756572792d746f6b656e696e7075742f66616365626f6f6b2d7374796c652e706e67" src="http://lh6.ggpht.com/-gL-dKwdWVEw/Tn8QNhYYVJI/AAAAAAAAAZM/qouh7GuEKd4/687474703a2f2f6c6f6f706a2e636f6d2f6a71756572792d746f6b656e696e7075742f66616365626f6f6b2d7374796c652e706e67_thumb%25255B3%25255D.png?imgmax=800" width="353" height="130" /&gt;&lt;/a&gt;&lt;a href="http://lh5.ggpht.com/-LLIkpx031QU/Tn8QP2A-_2I/AAAAAAAAAZQ/r9urJTvcs7I/s1600-h/687474703a2f2f6c6f6f706a2e636f6d2f6a71756572792d746f6b656e696e7075742f6c6973742d7374796c652e706e67%25255B4%25255D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="687474703a2f2f6c6f6f706a2e636f6d2f6a71756572792d746f6b656e696e7075742f6c6973742d7374796c652e706e67" border="0" alt="687474703a2f2f6c6f6f706a2e636f6d2f6a71756572792d746f6b656e696e7075742f6c6973742d7374796c652e706e67" src="http://lh4.ggpht.com/-zPg9Me63rTc/Tn8QRE2gFaI/AAAAAAAAAZU/3uwJa30lXoI/687474703a2f2f6c6f6f706a2e636f6d2f6a71756572792d746f6b656e696e7075742f6c6973742d7374796c652e706e67_thumb%25255B2%25255D.png?imgmax=800" width="324" height="83" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="https://github.com/harindaka/ASPTokenInput/wiki" target="_blank"&gt;ASPTokenInput&lt;/a&gt; is an ASP.Net server control which adds server side functionality, events and postback persistence to the Facebook style jquery autocomplete plugin named jquery-tokeninput found at &lt;a href="https://github.com/loopj/jquery-tokeninput" target="_blank"&gt;https://github.com/loopj/jquery-tokeninput&lt;/a&gt;. The &lt;a href="https://github.com/harindaka/ASPTokenInput/wiki" target="_blank"&gt;ASPTokenInput&lt;/a&gt; control also works within UpdatePanels. The library is released under the BSD &lt;a href="https://github.com/harindaka/ASPTokenInput/wiki/License" target="_blank"&gt;License&lt;/a&gt; and is hosted in &lt;a href="https://github.com/harindaka/ASPTokenInput/wiki" target="_blank"&gt;Github&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Visit the project wiki at &lt;a href="https://github.com/harindaka/ASPTokenInput/wiki" target="_blank"&gt;https://github.com/harindaka/ASPTokenInput/wiki&lt;/a&gt; for examples/details on how to download and use the control.&lt;/p&gt;  &lt;p&gt;Hope this helps.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-6098858442738491854?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=u0vmKdCQ1Oc:fnskKZpYXNE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=u0vmKdCQ1Oc:fnskKZpYXNE:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=u0vmKdCQ1Oc:fnskKZpYXNE:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=u0vmKdCQ1Oc:fnskKZpYXNE:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=u0vmKdCQ1Oc:fnskKZpYXNE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=u0vmKdCQ1Oc:fnskKZpYXNE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=u0vmKdCQ1Oc:fnskKZpYXNE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=u0vmKdCQ1Oc:fnskKZpYXNE:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=u0vmKdCQ1Oc:fnskKZpYXNE:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/u0vmKdCQ1Oc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/6098858442738491854/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=6098858442738491854" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/6098858442738491854?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/6098858442738491854?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/u0vmKdCQ1Oc/asptokeninput-facebook-style-token.html" title="ASPTokenInput: Facebook Style Token Based Autocomplete Control for ASP.Net" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-gL-dKwdWVEw/Tn8QNhYYVJI/AAAAAAAAAZM/qouh7GuEKd4/s72-c/687474703a2f2f6c6f6f706a2e636f6d2f6a71756572792d746f6b656e696e7075742f66616365626f6f6b2d7374796c652e706e67_thumb%25255B3%25255D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2011/09/asptokeninput-facebook-style-token.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEcARHozfSp7ImA9WhZbFUQ.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-4551960615069344166</id><published>2011-06-20T23:03:00.001+05:30</published><updated>2011-06-20T23:17:25.485+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-06-20T23:17:25.485+05:30</app:edited><title>Checking All CheckBoxes in an ASP.Net GridView Column With JQuery</title><content type="html">&lt;p&gt;Sometimes it’s the simplest things that can take a lot of time to figure out. Getting an ASP.Net GridView to display a checkbox column is pretty easy. However having a checkbox in the header template and changing the checked state of all other checkboxes in the item template in accordance can prove to be time consuming to figure out. So here’s how I did it using JQuery. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Solution for framework 3.5 and below&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Note that the ASP.Net checkbox server control renders a span which wraps the checkbox input type in the resulting html page. Hence when specifying a class using the CssClass property of the checkbox server control will render a &amp;lt;span class=”someClass”&amp;gt;&amp;lt;input type=”checkbox”/&amp;gt;&amp;lt;/span&amp;gt;. The markup would look like this&lt;/p&gt;  &lt;p&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;GridView &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;gvUsers&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;Columns&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;TemplateField&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;HeaderTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;CheckBox &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;chkAllUsers&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;onclick&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;$('.chkUserClass').children('input:checkbox').attr('checked', this.checked);&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;HeaderTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;CheckBox &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;chkUser&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;CssClass&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;chkUserClass&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;TemplateField&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;Columns&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;GridView&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&lt;/span&gt;Notice that the checkboxes in the item template is associated with the CSS Class chkUserClass. This is just a dummy class that we use to select all checkboxes via JQuery. Hence the piece of JQuery code in the onclick client side event of the header checkbox.&lt;/p&gt;  &lt;p&gt;&lt;span style="color: red"&gt;onclick&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;$('.chkUserClass').children('input:checkbox').attr('checked', this.checked);&amp;quot; &lt;/span&gt;&lt;/p&gt;  &lt;p&gt;This will select all input elements of the type checkbox which reside as children of the span elements with the class chkUserClass and then set the checked attribute to be the same as that of the header checkbox when it is clicked.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Got .Net 4.0? Its even easier.&lt;/strong&gt; &lt;/p&gt;  &lt;p&gt;If you are using .Net 4.0, Its even easier to do the same. Instead of the above just set the ClientIDMode property of the checkboxes in the item template to “Static” and then specify the jquery selector in the header checkbox’s onclick event using the checkbox id itself as follows,&lt;/p&gt;  &lt;p&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;GridView &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;gvUsers&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;Columns&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;TemplateField&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;HeaderTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;CheckBox &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;chkAllUsers&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;onclick&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;$('input:checkbox[id=chkUser]').attr('checked', this.checked);&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;HeaderTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;CheckBox &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;chkUser&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;ClientIDMode&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Static&amp;quot; /&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;TemplateField&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;Columns&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;GridView&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;     &lt;br /&gt;&lt;/span&gt;Hope this helps.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-4551960615069344166?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=2wllIHIuNa8:4DN2IQU5GoU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=2wllIHIuNa8:4DN2IQU5GoU:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=2wllIHIuNa8:4DN2IQU5GoU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=2wllIHIuNa8:4DN2IQU5GoU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=2wllIHIuNa8:4DN2IQU5GoU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=2wllIHIuNa8:4DN2IQU5GoU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=2wllIHIuNa8:4DN2IQU5GoU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=2wllIHIuNa8:4DN2IQU5GoU:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=2wllIHIuNa8:4DN2IQU5GoU:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/2wllIHIuNa8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/4551960615069344166/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=4551960615069344166" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/4551960615069344166?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/4551960615069344166?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/2wllIHIuNa8/checking-all-checkboxes-in-aspnet.html" title="Checking All CheckBoxes in an ASP.Net GridView Column With JQuery" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2011/06/checking-all-checkboxes-in-aspnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkEGSXo8fCp7ImA9WhdVGUk.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-8484033995417536390</id><published>2011-06-13T00:00:00.001+05:30</published><updated>2011-09-25T16:33:48.474+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-25T16:33:48.474+05:30</app:edited><title>Simple Plugins for .Net: Plugins in a Sweet Chocolaty AppDomain Wrapper</title><content type="html">&lt;script src="http://connect.facebook.net/en_US/all.js#xfbml=1"&gt;&lt;/script&gt;&lt;fb:like width="450" show_faces="true" href="http://simpleplugins.sourceforge.net"&gt;&lt;/fb:like&gt;  &lt;p&gt;It all started as a curious experiment when I started reading and studying the AppDomain related aspects of the .Net framework. As days went by the sample project I created for testing AppDomain behaviour morphed into a stable Plugins library which can be utilized by any .Net project to craft pluggable applications with only a few lines of code and zero AppDomain knowledge on the part of the developer. The Simple Plugins library wraps each plugin in its own AppDomain enabling its pluggable applications to be very secure and stable. It also manages the complexities involved in loading plugin assemblies into AppDomains without causing leaks. As the name suggests, using the Simple Plugins library is very simple and straightforward. The project is hosted at &lt;a href="https://github.com/harindaka/SimplePlugins" target="_blank"&gt;Github&lt;/a&gt; where you will find more details on how to use it. Why you should use Simple Plugins for your own projects can be summed up in 10 easy points.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Easily make existing .Net applications pluggable with a few lines of code and zero app domain knowledge. &lt;/li&gt;    &lt;li&gt;Write new pluggable .Net applications with a few lines of code and give plugin developers a simple API to work on that requires zero AppDomain knowledge. &lt;/li&gt;    &lt;li&gt;Isolation of plugins in their own App Domains, Automatic Loading and Unloading of App Domains, Dependant Assembly Resolution, Shadow Copy Support and much more. &lt;/li&gt;    &lt;li&gt;Prevent unhandled exceptions in plugins from crashing your app and prevent such exceptions from leaking AppDomains and causing unexpected behaviour in your pluggable application. (Handling thread exceptions is currently under development)&lt;/li&gt;    &lt;li&gt;Define whether plugins can execute synchronously, asynchronously and specify whether plugins need to run exclusively. &lt;/li&gt;    &lt;li&gt;Supports any type of plugin. GUI, Non-GUI etc. Supports plugins in the form of dynamic link libraries or executable files. &lt;/li&gt;    &lt;li&gt;Keep track of loaded plugins. Be aware of each plugin's state and take actions (cancel plugin loading, customize app domain setup, etc) through numerous events exposed by the Plugin Loader. &lt;/li&gt;    &lt;li&gt;Pass parameters to plugins and process their returned results seamlessly without having to worry about app domain logic. &lt;/li&gt;    &lt;li&gt;Allow an app.config file per each plugin. &lt;/li&gt;    &lt;li&gt;Not satisfied with the provided plugin or loader functionality? Easily write your own plugin class and define your own plugin loader by extending the provided classes. &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;So visit &lt;a href="https://github.com/harindaka/SimplePlugins" target="_blank"&gt;https://github.com/harindaka/SimplePlugins&lt;/a&gt; and start writing your very own pluggable app today!&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-8484033995417536390?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=bXUIMnxKNR8:4KuogLl0qQk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=bXUIMnxKNR8:4KuogLl0qQk:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=bXUIMnxKNR8:4KuogLl0qQk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=bXUIMnxKNR8:4KuogLl0qQk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=bXUIMnxKNR8:4KuogLl0qQk:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=bXUIMnxKNR8:4KuogLl0qQk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=bXUIMnxKNR8:4KuogLl0qQk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=bXUIMnxKNR8:4KuogLl0qQk:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=bXUIMnxKNR8:4KuogLl0qQk:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/bXUIMnxKNR8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/8484033995417536390/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=8484033995417536390" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/8484033995417536390?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/8484033995417536390?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/bXUIMnxKNR8/simple-plugins-for-net-plugins-in-sweet.html" title="Simple Plugins for .Net: Plugins in a Sweet Chocolaty AppDomain Wrapper" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2011/06/simple-plugins-for-net-plugins-in-sweet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEIGRHw5eCp7ImA9Wx9SGUs.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-6554004713986887628</id><published>2010-12-10T11:58:00.001+05:30</published><updated>2010-12-10T11:58:45.220+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-10T11:58:45.220+05:30</app:edited><title>Where’s My PDF Toolbar Chrome?</title><content type="html">&lt;p&gt;Like many people out there I’m starting to prefer the Google Chrome browser (Currently v8.0) over my “used to be” favourite, firefox. Anyhow I recently came across a recently annoying aspect in Google Chrome that in my view could end up being a headache for Systems Admins in large companies which use web based systems for reporting. This might annoy some of the individual users out there too.&lt;/p&gt;  &lt;p&gt;So when you open a link to a pdf document in the web using Chrome you don’t get the usual pdf toolbar to be visible. Instead you are presented with only the document and nothing else. Yep No print button, no navigation buttons. Nada. Try explaining to some 100 users why there’s no print button in your web reports anymore and you’ll get the picture.&lt;/p&gt;  &lt;p&gt;Google came to the rescue though as I was able to find after abt 20 secs of searching that Google Chrome uses its own plugin to render PDF. So you have to disable that and have only Adobe’s PDF plugin enabled. Here’s how to do just that.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Make sure you have Adobe reader installed.&lt;/li&gt;    &lt;li&gt;In the Chrome address bar type about:plugins and press enter.&lt;/li&gt;    &lt;li&gt;Now locate the plugin titled “Chrome PDF Viewer” and click the “Disable” link below it to disable the plugin.&lt;/li&gt;    &lt;li&gt;Open a pdf link and enjoy&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Yep its as simple as that. IMHO this issue shouldn’t be there in Chrome. Why would you want another plugin if you already have a better and working one. Why reinvent the wheel google? Why fix it if it aint broke?&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-6554004713986887628?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=B1oJVY6g0c8:1IerwjJckFQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=B1oJVY6g0c8:1IerwjJckFQ:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=B1oJVY6g0c8:1IerwjJckFQ:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=B1oJVY6g0c8:1IerwjJckFQ:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=B1oJVY6g0c8:1IerwjJckFQ:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=B1oJVY6g0c8:1IerwjJckFQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=B1oJVY6g0c8:1IerwjJckFQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=B1oJVY6g0c8:1IerwjJckFQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=B1oJVY6g0c8:1IerwjJckFQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/B1oJVY6g0c8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/6554004713986887628/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=6554004713986887628" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/6554004713986887628?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/6554004713986887628?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/B1oJVY6g0c8/wheres-my-pdf-toolbar-chrome.html" title="Where’s My PDF Toolbar Chrome?" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2010/12/wheres-my-pdf-toolbar-chrome.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QHR386cCp7ImA9WxFUFU4.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-4960329125268611929</id><published>2010-06-26T11:49:00.016+05:30</published><updated>2010-06-26T12:25:36.118+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-26T12:25:36.118+05:30</app:edited><title>Corrupt MDAC Fix : Error 3706 Provider cannot be found. It may not be properly installed.</title><content type="html">Wow it's been a while since I did my last post. All the more reason to enjoy this one.&lt;br /&gt;I often came across the dreaded "Provider cannot be found. It may not be properly installed." error when trying to access data sources via VB 6 code in some legacy apps but was never compelled to look for a solution since I was always able to find a quick workaround... that is until I had to look into one which accessed dBase data files (*.dbf).&lt;br /&gt;&lt;br /&gt;After some googling and chewing off some fingernails in frustration, I came to the conclusion that re-installing MDAC via microsoft's mdac_typ.exe didn't help at all. However I was lucky enough to find a solution which involved manual copying and registering of the required dll files which made the error go away for good. Though the first solution mentioned below did not work for me I'll just post it as a reference since it seems to be a safer approach than the second one which did. It never hurts to try :D&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. Download the redistributable package, &lt;a href="ftp://ftp.trinet.co.uk/trinet/Programs/Microsoft/script/MDAC_TYP.exe" target="_blank"&gt;MDAC_TYP.exe&lt;/a&gt;&lt;br /&gt;2. Extract the package to a folder (c:\temp in this case), using the command&lt;br /&gt;&lt;blockquote&gt;mdac_typ /C /T:c:\temp&lt;br /&gt;&lt;/blockquote&gt;3. In the extracted folder, locate the file &lt;span class="kbfile"&gt;MDACXPAC.INF&lt;/span&gt;. Right-click  and choose &lt;span class="kbmenu"&gt;Install&lt;/span&gt;.&lt;br /&gt;4. Restart the computer.&lt;br /&gt;&lt;br /&gt;If this doesn't work (Didn't work for me) try the one below.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Solution 2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. In the extracted folder (c:\temp), extract the file &lt;span class="kbfile"&gt;MDACXPAK.CAB&lt;/span&gt; using WinZip or WinRAR to another folder (say c:\temp\mdacxpack), etc.&lt;br /&gt;2. In that folder create a .bat file using the following content and run it.&lt;br /&gt;&lt;blockquote&gt;md ADO&lt;br /&gt;copy /b MSADER15.DLL ADO\*.*&lt;br /&gt;copy /b MSADO15.DLL ADO\*.*&lt;br /&gt;copy /b MSADO20.TLB ADO\*.*&lt;br /&gt;copy /b MSADO21.TLB ADO\*.*&lt;br /&gt;copy /b MSADOMD.DLL ADO\*.*&lt;br /&gt;copy /b MSADOR15.DLL ADO\*.*&lt;br /&gt;copy /b MSADOX.DLL ADO\*.*&lt;br /&gt;copy /b MSADRH15.DLL ADO\*.*&lt;br /&gt;copy /b MSJRO.DLL ADO\*.*&lt;br /&gt;&lt;br /&gt;md MSADC&lt;br /&gt;copy /b MSADCE.DLL MSADC\*.*&lt;br /&gt;copy /b MSADCER.DLL MSADC\*.*&lt;br /&gt;copy /b MSADCF.DLL MSADC\*.*&lt;br /&gt;copy /b MSADCFR.DLL MSADC\*.*&lt;br /&gt;copy /b MSADCO.DLL MSADC\*.*&lt;br /&gt;copy /b MSADCOR.DLL MSADC\*.*&lt;br /&gt;copy /b MSADCS.DLL MSADC\*.*&lt;br /&gt;copy /b MSADDS.DLL MSADC\*.*&lt;br /&gt;copy /b MSADDSR.DLL MSADC\*.*&lt;br /&gt;copy /b MSDAPRSR.DLL MSADC\*.*&lt;br /&gt;copy /b MSDAPRST.DLL MSADC\*.*&lt;br /&gt;copy /b MSDAREM.DLL MSADC\*.*&lt;br /&gt;copy /b MSDAREMR.DLL MSADC\*.*&lt;br /&gt;copy /b MSDFMAP.DLL MSADC\*.*&lt;br /&gt;&lt;br /&gt;md "OLE DB"&lt;br /&gt;copy /b MSDADC.DLL "OLE DB\*.*"&lt;br /&gt;copy /b MSDAENUM.DLL "OLE DB\*.*"&lt;br /&gt;copy /b MSDAER.DLL "OLE DB\*.*"&lt;br /&gt;copy /b MSDAORA.DLL "OLE DB\*.*"&lt;br /&gt;copy /b MSDAOSP.DLL "OLE DB\*.*"&lt;br /&gt;copy /b MSDAPS.DLL "OLE DB\*.*"&lt;br /&gt;copy /b MSDASC.DLL "OLE DB\*.*"&lt;br /&gt;copy /b MSDASQL.DLL "OLE DB\*.*"&lt;br /&gt;copy /b MSDASQLR.DLL "OLE DB\*.*"&lt;br /&gt;copy /b MSDATL2.DLL "OLE DB\*.*"&lt;br /&gt;copy /b MSDATT.DLL "OLE DB\*.*"&lt;br /&gt;copy /b MSDAURL.DLL "OLE DB\*.*"&lt;br /&gt;copy /b MSXACTPS.DLL "OLE DB\*.*"&lt;br /&gt;copy /b OLEDB32.DLL "OLE DB\*.*"&lt;br /&gt;copy /b OLEDB32R.DLL "OLE DB\*.*"&lt;br /&gt;copy /b OLEDB32X.DLL "OLE DB\*.*"&lt;/blockquote&gt;3. Copy the three subfolders to &lt;span class="kbfolder"&gt;C:\Program  Files\Common Files\System\&lt;/span&gt;, overwriting the existing files and  folders&lt;br /&gt;4. Create another .bat file in the &lt;span class="kbfolder"&gt;C:\Program Files\Common Files\System\&lt;/span&gt; folder with the following content and run it. This is to register the dlls.&lt;br /&gt;&lt;blockquote&gt;regsvr32 /u /s ADO\msado15.dll&lt;br /&gt;regsvr32 /u /s ADO\msador15.dll&lt;br /&gt;regsvr32 /u /s ADO\msadrh15.dll&lt;br /&gt;regsvr32 /u /s ADO\msadomd.dll&lt;br /&gt;regsvr32 /u /s ADO\msadox.dll&lt;br /&gt;regsvr32 /u /s ADO\msjro.dll&lt;br /&gt;regsvr32 /u /s MSADC\msadce.dll&lt;br /&gt;regsvr32 /u /s MSADC\msadcf.dll&lt;br /&gt;regsvr32 /u /s MSADC\msadco.dll&lt;br /&gt;regsvr32 /u /s MSADC\msadds.dll&lt;br /&gt;regsvr32 /u /s MSADC\msdaprst.dll&lt;br /&gt;regsvr32 /u /s MSADC\msdarem.dll&lt;br /&gt;regsvr32 /u /s MSADC\msdfmap.dll&lt;br /&gt;regsvr32 /u /s "OLE DB\oledb32.dll"&lt;br /&gt;regsvr32 /u /s "OLE DB\msxactps.dll"&lt;br /&gt;regsvr32 /u /s "OLE DB\msdaenum.dll"&lt;br /&gt;regsvr32 /u /s "OLE DB\msdaurl.dll"&lt;br /&gt;regsvr32 /u /s "OLE DB\msdatt.dll"&lt;br /&gt;regsvr32 /u /s "OLE DB\msdasql.dll"&lt;br /&gt;regsvr32 /u /s "OLE DB\msdaosp.dll"&lt;br /&gt;regsvr32 /u /s "OLE DB\msdaora.dll"&lt;br /&gt;regsvr32 /u /s "OLE DB\msdaps.dll"&lt;br /&gt;&lt;br /&gt;regsvr32 /s ADO\msado15.dll&lt;br /&gt;regsvr32 /s ADO\msador15.dll&lt;br /&gt;regsvr32 /s ADO\msadrh15.dll&lt;br /&gt;regsvr32 /s ADO\msadomd.dll&lt;br /&gt;regsvr32 /s ADO\msadox.dll&lt;br /&gt;regsvr32 /s ADO\msjro.dll&lt;br /&gt;regsvr32 /s MSADC\msadce.dll&lt;br /&gt;regsvr32 /s MSADC\msadcf.dll&lt;br /&gt;regsvr32 /s MSADC\msadco.dll&lt;br /&gt;regsvr32 /s MSADC\msadds.dll&lt;br /&gt;regsvr32 /s MSADC\msdaprst.dll&lt;br /&gt;regsvr32 /s MSADC\msdarem.dll&lt;br /&gt;regsvr32 /s MSADC\msdfmap.dll&lt;br /&gt;regsvr32 /s "OLE DB\oledb32.dll"&lt;br /&gt;regsvr32 /s "OLE DB\msxactps.dll"&lt;br /&gt;regsvr32 /s "OLE DB\msdaenum.dll"&lt;br /&gt;regsvr32 /s "OLE DB\msdaurl.dll"&lt;br /&gt;regsvr32 /s "OLE DB\msdatt.dll"&lt;br /&gt;regsvr32 /s "OLE DB\msdasql.dll"&lt;br /&gt;regsvr32 /s "OLE DB\msdaosp.dll"&lt;br /&gt;regsvr32 /s "OLE DB\msdaora.dll"&lt;br /&gt;regsvr32 /s "OLE DB\msdaps.dll"&lt;/blockquote&gt;&lt;br /&gt;That should do it. Hope this helps.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-4960329125268611929?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=rRGkk5hBRV4:56EiDzysFJo:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=rRGkk5hBRV4:56EiDzysFJo:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=rRGkk5hBRV4:56EiDzysFJo:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=rRGkk5hBRV4:56EiDzysFJo:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=rRGkk5hBRV4:56EiDzysFJo:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=rRGkk5hBRV4:56EiDzysFJo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=rRGkk5hBRV4:56EiDzysFJo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=rRGkk5hBRV4:56EiDzysFJo:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=rRGkk5hBRV4:56EiDzysFJo:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/rRGkk5hBRV4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/4960329125268611929/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=4960329125268611929" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/4960329125268611929?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/4960329125268611929?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/rRGkk5hBRV4/corrupt-mdac-fix-error-3706-provider.html" title="Corrupt MDAC Fix : Error 3706 Provider cannot be found. It may not be properly installed." /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>4</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2010/06/corrupt-mdac-fix-error-3706-provider.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEYBRH8_fyp7ImA9WxNWEko.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-602454746515393605</id><published>2009-08-18T12:37:00.002+05:30</published><updated>2009-10-11T21:19:15.147+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-10-11T21:19:15.147+05:30</app:edited><title>Sticky Notes On Your Desktop! Tray Buddy v2.0 Released.</title><content type="html">&lt;p&gt;Tray Buddy is a simple FREE Desktop Notes application developed for the Microsoft Windows (Windows 2000 and above) platform under the &lt;a href="http://www.gnu.org/licenses/gpl.html" target="_blank"&gt;GNU GPL&lt;/a&gt;.&lt;/p&gt;  &lt;table border="0" cellpadding="2" cellspacing="0" width="396"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td width="36"&gt; &lt;a href="http://lh6.ggpht.com/_ygVs045XHlc/SopTK0_44gI/AAAAAAAAAXY/XKnBx1f0y-Y/NOTE17%5B1%5D.png"&gt;&lt;img style="border-width: 0px;" alt="NOTE17" src="http://lh4.ggpht.com/_ygVs045XHlc/SopTPAAhcQI/AAAAAAAAAXc/UwKUO9JbNZY/NOTE17_thumb%5B1%5D.png" border="0" height="26" width="26" /&gt;&lt;/a&gt; &lt;/td&gt;        &lt;td width="357"&gt;&lt;span style="font-size:180%;"&gt;&lt;a href="http://traybuddy.blogspot.com/" target="_blank"&gt;Click here to get it!&lt;/a&gt;&lt;/span&gt;&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Tray Buddy lets users keep sticky notes on the desktop. See illustration below. &lt;/p&gt; &lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_ygVs045XHlc/SEfM9EgdHGI/AAAAAAAAAPc/rw-yk_8NVF0/s1600-h/DesktopWithNotes.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5208356843631221858" style="margin: 0px auto 10px; display: block; cursor: pointer; text-align: center;" alt="" src="http://3.bp.blogspot.com/_ygVs045XHlc/SEfM9EgdHGI/AAAAAAAAAPc/rw-yk_8NVF0/s320/DesktopWithNotes.jpg" border="0" /&gt;&lt;/a&gt; &lt;p&gt;Enjoy!&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-602454746515393605?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=KwPZSFjG9Mo:QSKmfa9uNNE:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=KwPZSFjG9Mo:QSKmfa9uNNE:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=KwPZSFjG9Mo:QSKmfa9uNNE:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=KwPZSFjG9Mo:QSKmfa9uNNE:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=KwPZSFjG9Mo:QSKmfa9uNNE:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=KwPZSFjG9Mo:QSKmfa9uNNE:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=KwPZSFjG9Mo:QSKmfa9uNNE:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=KwPZSFjG9Mo:QSKmfa9uNNE:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=KwPZSFjG9Mo:QSKmfa9uNNE:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/KwPZSFjG9Mo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/602454746515393605/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=602454746515393605" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/602454746515393605?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/602454746515393605?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/KwPZSFjG9Mo/sticky-notes-on-your-desktop-tray-buddy.html" title="Sticky Notes On Your Desktop! Tray Buddy v2.0 Released." /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/_ygVs045XHlc/SopTPAAhcQI/AAAAAAAAAXc/UwKUO9JbNZY/s72-c/NOTE17_thumb%5B1%5D.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2009/08/sticky-notes-on-your-desktop-tray-buddy.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0MMSXoyeSp7ImA9WxJXFEo.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-8999678622139643075</id><published>2009-06-08T21:08:00.001+05:30</published><updated>2009-06-08T21:08:08.491+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-06-08T21:08:08.491+05:30</app:edited><title>Fix the Fox : 3 Hacks to Reduce Firefox Memory Consumption</title><content type="html">&lt;p&gt;Being a web developer my daily work routine involves heavy browser usage. Since I also need to test web pages being developed for cross browser compatibility, I use different browsers too. i.e. Microsoft Internet Explorer, Opera, Safari, Google Chrome and ofcourse my favourite - Mozilla Firefox.&lt;/p&gt;  &lt;p&gt;Having used these browsers side by side for a long time I noticed that firefox tends to use up a lot of memory when you use it continuously for a long period of time. I was aware of the memory leaks that plagued firefox from the start hence I continued to ignore this small issue of high memory consumption and kept closing tabs regularly to free up memory thinking it would make a difference. Well.... I was wrong. I was so startled that I almost fell off my chair one day when I saw in the MS Task Manager that FF was using more than 100 MB of memory. For a user like myself on a PC which had a total of only just 512 MB of memory, this was an utterly ridiculous predicament to be in. On top of that FF wasn't using many add-ons at the time and it had not loaded any flash movies or anything like that either. Hence it was a &amp;quot;scratch my head&amp;quot; moment :D&lt;/p&gt;  &lt;p&gt;As always I turned to Google for help. After about 10 minutes of googling I managed to come across 3 easy steps to make FF run like the wind. And you know what? They really did the trick for me :D So here's what you do,&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;1. browser.sessionhistory.max_entries&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Firefox saves the last 50 visited websites of a single session in memory which means that it could add up quickly if you visit lots of content filled websites. The reason behind this is that it is faster to access an already visited website if it still resides in memory instead of loading it from disk cache or from the server. But 50 is a little too much don't you think? Hence if you are a user like me with little memory but browses a lot of different websites during a browsing session, yeah it sucks to be you... unless you do the following,&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Type about:config in the Firefox address bar and press Enter&lt;/li&gt;    &lt;li&gt;Search for the term &lt;strong&gt;browser.sessionhistory.max_entries&lt;/strong&gt;&lt;/li&gt;    &lt;li&gt;Right-click the entry, select modify from the list and change it to a lower value. (5 works for me)&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;strong&gt;2. config.trim_on_minimize&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Wouldn't it be nice if FF released unused memory when you minimize it? Makes sense doesn't it. Well by default FF does not do it. So you've got to tell FF to do so as follows,&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Type about:config in the Firefox address bar and press Enter&lt;/li&gt;    &lt;li&gt;Right click on the tab and go to New &amp;gt; Boolean.&lt;/li&gt;    &lt;li&gt;Type &lt;strong&gt;config.trim_on_minimize&lt;/strong&gt; and set it to true.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Now whenever you minimize firefox, it&amp;#8217;ll reduce the amount of ram it takes up.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;3. browser.cache.memory.capacity&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;When images are loaded, they can be cached so they don't need to be decoded or uncompressed to be redisplayed. This preference controls the maximum amount of memory to use for caching decoded images and chrome (application user interface elements). Firefox dynamically assigns memory cache usage. To reduce memory consumption, you could specify a lower value for the memory cache capacity yourself as follows,&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Type about:config in the Firefox address bar and press Enter&lt;/li&gt;    &lt;li&gt;Right click on the tab and go to New &amp;gt; Integer.&lt;/li&gt;    &lt;li&gt;Type &lt;strong&gt;browser.cache.memory.capacity&lt;/strong&gt; and set it to a value mentioned below. These values depend on the amount of your total RAM. Yes you can experiment with lower than default values too.&lt;/li&gt; &lt;/ul&gt;  &lt;table cellspacing="0" cellpadding="2" width="400" border="1"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="200"&gt;&lt;strong&gt;Physical RAM&lt;/strong&gt; &lt;/td&gt;        &lt;td valign="top" width="200"&gt;&lt;strong&gt;Memory Cache (in KB)&lt;/strong&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;32 MB&lt;/td&gt;        &lt;td valign="top" width="200"&gt;2048&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;64 MB&amp;#160; &lt;/td&gt;        &lt;td valign="top" width="200"&gt;4096&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;128 MB&amp;#160; &lt;/td&gt;        &lt;td valign="top" width="200"&gt;6144&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;256 MB&lt;/td&gt;        &lt;td valign="top" width="200"&gt;10240&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;512 MB&lt;/td&gt;        &lt;td valign="top" width="200"&gt;14336&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;1 GB&lt;/td&gt;        &lt;td valign="top" width="200"&gt;18432&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;2 GB&amp;#160; &lt;/td&gt;        &lt;td valign="top" width="200"&gt;24576&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;4 GB&amp;#160; &lt;/td&gt;        &lt;td valign="top" width="200"&gt;30720&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="200"&gt;8 GB and up&amp;#160; &lt;/td&gt;        &lt;td valign="top" width="200"&gt;32768&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;Also Note:&lt;/strong&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;ul&gt;   &lt;ul&gt;     &lt;li&gt;The &lt;strong&gt;browser.cache.memory.enable&lt;/strong&gt; value must be true for this preference to take effect. (This is true by default)&lt;/li&gt;      &lt;li&gt;Lowering this value causes less memory to be used but also increases the load time of previously visited pages and dialogs. Raising it has the opposite effect.&lt;/li&gt;      &lt;li&gt;To view current memory cache usage, put &lt;strong&gt;about:cache?device=memory&lt;/strong&gt; in the Location Bar and press Enter.&lt;/li&gt;      &lt;li&gt;This preference does not exist by default in Mozilla applications other than Thunderbird.&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt;Now restart your fox and let it run like the wind :D&lt;/p&gt;  &lt;p&gt;Hope this helps.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-8999678622139643075?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=DzvBBWxKyAc:a37ecKdn1dU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=DzvBBWxKyAc:a37ecKdn1dU:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=DzvBBWxKyAc:a37ecKdn1dU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=DzvBBWxKyAc:a37ecKdn1dU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=DzvBBWxKyAc:a37ecKdn1dU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=DzvBBWxKyAc:a37ecKdn1dU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=DzvBBWxKyAc:a37ecKdn1dU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=DzvBBWxKyAc:a37ecKdn1dU:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=DzvBBWxKyAc:a37ecKdn1dU:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/DzvBBWxKyAc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/8999678622139643075/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=8999678622139643075" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/8999678622139643075?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/8999678622139643075?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/DzvBBWxKyAc/fix-fox-3-hacks-to-reduce-firefox.html" title="Fix the Fox : 3 Hacks to Reduce Firefox Memory Consumption" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2009/06/fix-fox-3-hacks-to-reduce-firefox.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcER3Y-eip7ImA9WxVVFUU.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-2845833769226672983</id><published>2009-03-09T14:10:00.001+05:30</published><updated>2009-03-09T14:10:06.852+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-03-09T14:10:06.852+05:30</app:edited><title>ASP.NET AJAX : Update Panels and Register Script Woes</title><content type="html">&lt;p&gt;Recently I was working on a composite control which required me to register some javascript snippets via the normal method in ASP.NET i.e. by calling the following method.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;Control.Page.ClientScript.RegisterStartupScript()&lt;/strong&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The objective of the javascript snippet was to hide the composite control when a certain link button was pressed. All worked fine until I placed the control inside an UpdatePanel in which case the javascript didn't get fired at all. After a little bit of googling I found out that when using ASP.NET AJAX controls, a totally different approach was necessary. I quote Rick Strahl&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;span lang="EN"&gt;&lt;font face="Verdana" size="2"&gt;&lt;span lang="EN"&gt;&lt;span lang="EN"&gt;&lt;em&gt;&amp;quot;The problem is that Microosft decided in MS AJAX Beta to go with a completely separate script generation engine which is driven through the ScriptManager control. The MS Ajax ScriptManager mimics many of the ClientScript object&amp;#8217;s methods, but provides them as static methods (thankfully! without that we&amp;#8217;d be really screwed).&amp;quot;&lt;/em&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Hence registering client scripts via Page.ClientScript.RegisterStartupScript() or Page.ClientScript.RegisterClientScriptBlock() won't work. Instead use the following,&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;ScriptManager.RegisterStartupScript() or ScriptManager.RegisterClientScriptBlock()&lt;/strong&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;to register the client javascripts when using ASP.NET AJAX UpdatePanels. The major drawback to this method is that a ScriptManager actually has to be present on the page for it to work. So what's the big deal with that you may ask...&lt;/p&gt;  &lt;p&gt;Well for one thing, this decision taken by Micro$oft to adopt a new script engine totally breaks code in legacy controls which were developed prior to ASP.Net AJAX and prevent them from being used inside UpdatePanels. It gets even worse... How? Just imagine.... What if we have to use the same composite control with and without the UpdatePanel in the same application? Bummer! You dont want to end up using a ScriptManager on all pages now do you?&lt;/p&gt;  &lt;p&gt;Thank god for workarounds :D &lt;a href="http://www.west-wind.com/WebLog/posts/9601.aspx" target="_blank"&gt;Here's what Rick Strahl did&lt;/a&gt; to work around it by developing a wrapper class to probe if a ScriptManager was present or not and then register the script via the appropriate method.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Hope this helps.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-2845833769226672983?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=Tgrb9nSEeyM:RozwgY5gwcM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=Tgrb9nSEeyM:RozwgY5gwcM:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=Tgrb9nSEeyM:RozwgY5gwcM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=Tgrb9nSEeyM:RozwgY5gwcM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=Tgrb9nSEeyM:RozwgY5gwcM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=Tgrb9nSEeyM:RozwgY5gwcM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=Tgrb9nSEeyM:RozwgY5gwcM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=Tgrb9nSEeyM:RozwgY5gwcM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=Tgrb9nSEeyM:RozwgY5gwcM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/Tgrb9nSEeyM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/2845833769226672983/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=2845833769226672983" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/2845833769226672983?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/2845833769226672983?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/Tgrb9nSEeyM/aspnet-ajax-update-panels-and-register.html" title="ASP.NET AJAX : Update Panels and Register Script Woes" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2009/03/aspnet-ajax-update-panels-and-register.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0AHQH47eyp7ImA9WxRUEE0.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-1324487561468533466</id><published>2008-11-18T15:57:00.007+05:30</published><updated>2008-11-18T16:25:31.003+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-18T16:25:31.003+05:30</app:edited><title>Search Engine Optimization : The Dos and the Donts</title><content type="html">&lt;div xmlns="http://www.w3.org/1999/xhtml"&gt;Search Engine Optimization is not an exact science. However the following methods can be utilized to increase the possibility of your site's pages to be listed among the topmost items in a search engine such as google or msn.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;If it is important, it should be in text&lt;/b&gt;&lt;br /&gt;Search engines only index text. So important content should be textually present in your pages. Placing such information in images and flash will not get them indexed. Although there maybe some exceptions to that rule as SEs are getting more intelligent and extending indexing capabilities towards other file types such as pdfs, it would not be wise to depend on that fact.&lt;br /&gt;If a page doesn't contain at least 250 words, some search engines won't bother to index it. It's preferable to have 500 words or more if possible, on a page. You'll get better results from the search engines if you have more text.&lt;br /&gt;Text should be as close to the beginning of the page as possible, because there is a limit to how far down into a page a search engine spider will go to try to find text. It is generally agreed that this is 3kb. That's only about 80-100 lines of code! So make sure your text comes before some really long JavaScript menu in the code for the page, or else the search engine won't make it far enough into the page to index the text.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Optimize more than one page&lt;/b&gt;&lt;br /&gt;Just optimizing the site root page is not enough. Other pages should be optimized accordingly too.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;A good domain name is half the battle&lt;br /&gt;&lt;/b&gt;Pick a domain name which would include at least part of what the users will be searching for. i.e. if your site is renting cars in a city called acme then the domain name should be something like www.acmecarrental.com.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Pick a good web hosting company&lt;/b&gt;&lt;br /&gt;Free website hosting is usually bad for search engine rankings. There are several reasons for this. One would be that you are often not in control of the domain name you are given. Free hosts often place your site inside its own frame or place adds or annoying popups on your site. For more details &lt;a href="http://www.netmechanic.com/news/vol5/promo_no6.htm" target="_blank"&gt;click here&lt;/a&gt;.&lt;br /&gt;Another thing to consider is whether your web hosting company host spammers or pornographic sites which have a great potential to be banned by SEs. If this is the case then your site may also be banned for good by the SEs due to "association".&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Static IP&lt;/b&gt;&lt;br /&gt;The website should have its own dedicated static ip address. Big hosting companies typically use "dynamically assigned" IP addresses. This means that when someone types in your URL into his browser, the HTTP request is presented to your hosting company's server, which quickly assigns an IP address to your website files on its server and connects the visitor to your files. For some search engines this is a total turnoff.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Keywords&lt;br /&gt;&lt;/b&gt;Figure out the right keywords for each page to be optimized and place them inside the &amp;lt;title&amp;gt; and &amp;lt;meta&amp;gt; tags within the &amp;lt;head&amp;gt; tag. Ofcourse the title of the page should make sense as it is displayed but you can use the meta tags to specify more key words. However the keyword meta tag has become obsolete now since major SEs like google completely ignores it. Yet it doesnt hurt to have them inside the pages all the same.&lt;br /&gt;&lt;br /&gt;i.e. &amp;lt;meta name="keywords" content="acme,cars,rent"&amp;gt;&lt;br /&gt;&lt;br /&gt;The &amp;lt;meta&amp;gt; description tag is a description of the page. This tag should describe the specific page it is on, not the whole website. This is the description of the page that shows up at the search engine when someone is lucky enough to find this page in his search.&lt;br /&gt;&lt;br /&gt;i.e. &amp;lt;meta name="description" content="Toyota Prius rental package,car features,fee"&amp;gt;&lt;br /&gt;&lt;br /&gt;CAUTION : Don't repeat individual key words more than twice in any one meta tag because that can get a site banned from search engines&lt;br /&gt;The &amp;lt;title&amp;gt; tag must contain the main keyword phrase for which you are optimizing that page. Google in particular places heavy emphasis on what is in your page's &amp;lt;title&amp;gt; tag. So does MSN. IMHO the &amp;lt;title&amp;gt; tag is the most important tag which can be used to get the pages indexed so get it right.&lt;br /&gt;In addition, the same keywords should also be present in the body (content) of the document. It also seems to help to put the key word phrase near the end of the text, too. Search engines use a factor called "key word density" to determine how relevant that key word you're using is to the page. If it shows up a few times in the text, it is more "dense". Key word density is a good thing, up to a certain point.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Page Headings&lt;br /&gt;&lt;/b&gt;Put keywords inside headings using the &amp;lt;h1&amp;gt;, &amp;lt;h2&amp;gt;, &amp;lt;h3&amp;gt;, etc. tags. Search engines will look for and index headings when they index pages. Some people detest using headings because they tend to be ugly. You can easily bypass this using a simple inline style command, like this:&lt;br /&gt;&amp;lt;H1 style="margin-bottom: 0px; font-size: 12px;"&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Images and Alt tags&lt;br /&gt;&lt;/b&gt;Images on a web page should contain a little text description that only shows up when you move your mouse over the picture. That little description is called an "ALT tag". These ALT tags are necessary since some SEs index them. Hence be sure to include keywords in them. This will also help SEs index the images in your website.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Anchor tags&lt;/b&gt;&lt;br /&gt;Hyperlinks in your site will utilize anchor tags. You can include keywords inside these tags too. i.e. &amp;lt;a href="prius.html" title="Toyota Prius Rental Package"&amp;gt; Toyota Prius &amp;lt;/a&amp;gt; These "titles" for the anchor tags get indexed by the search engines.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;HTML validation&lt;br /&gt;&lt;/b&gt;Validate the page html to ensure that your html code conforms to standards as much as possible. The more the conformance the easier it is for the SE crawlers to go through your page. You may use online tools such as the one found &lt;a href="http://validator.w3.org/" target="_blank"&gt;here&lt;/a&gt; to do this.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Manual SE registration&lt;br /&gt;&lt;/b&gt;The site should be submitted to (registered with) the search engines (like Google and MSN) and directories (like Yahoo! and the ODP). Most of these are free.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Links to your site&lt;br /&gt;&lt;/b&gt;Go out and find as many other websites as possible that might have an interest in linking from their site to yours, contact them and convince them to set up such links. The more links there are to your site, the more relevance it will get in most SEs.&lt;br /&gt;i.e. Google Page Rank&lt;br /&gt;Page rank is Google's way of measuring your rank in terms of links to your site from other sites, based on both quantity and quality. Google page rank varies from 0 (terrible) to 10 (ideal). If you have lots of links from sites with low page ranks, they will mean very little to your page rank, whereas even a few links from other sites with good page ranks can make a difference. That doesn't mean you should cancel existing links. They still have value.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I'm sure there are many more means by which you can do SEO. Please take some time to comment on them too.&lt;br /&gt;&lt;br /&gt;Hope this helps.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-1324487561468533466?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=y4WymbEJAV4:PuzCtN5-UPM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=y4WymbEJAV4:PuzCtN5-UPM:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=y4WymbEJAV4:PuzCtN5-UPM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=y4WymbEJAV4:PuzCtN5-UPM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=y4WymbEJAV4:PuzCtN5-UPM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=y4WymbEJAV4:PuzCtN5-UPM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=y4WymbEJAV4:PuzCtN5-UPM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=y4WymbEJAV4:PuzCtN5-UPM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=y4WymbEJAV4:PuzCtN5-UPM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/y4WymbEJAV4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/1324487561468533466/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=1324487561468533466" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/1324487561468533466?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/1324487561468533466?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/y4WymbEJAV4/search-engine-optimization-dos-and.html" title="Search Engine Optimization : The Dos and the Donts" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/11/search-engine-optimization-dos-and.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEIERn85eSp7ImA9WxRXEEs.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-5912417625885639612</id><published>2008-10-15T14:10:00.005+05:30</published><updated>2008-10-15T15:58:27.121+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-15T15:58:27.121+05:30</app:edited><title>Postgre SQL : How to List All Databases on a Postgre Server</title><content type="html">In a Postgre SQL Server, the available database list is kept in a table called &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;'pg_database'&lt;/span&gt;. This table can be found in all databases in the server and is shared among all databases in a cluster.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The pg_database table contains the following columns,&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style=" ;font-family:'Georgia';"&gt;&lt;a name="AEN8914"&gt;&lt;table border="1" bgcolor="#E0E0E0" cellspacing="0" cellpadding="4" class="CALSTABLE"&gt;&lt;thead&gt;&lt;tr&gt;&lt;th width="115" align="LEFT" valign="TOP"&gt;Name&lt;/th&gt;&lt;th width="67" align="LEFT" valign="TOP"&gt;Type&lt;/th&gt;&lt;th width="125" align="LEFT" valign="TOP"&gt;References&lt;/th&gt;&lt;th width="100%" align="LEFT" valign="TOP"&gt;Description&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td width="115" align="LEFT" valign="TOP"&gt;datname&lt;/td&gt;&lt;td width="67" align="LEFT" valign="TOP"&gt;&lt;span class="TYPE"&gt;name&lt;/span&gt;&lt;/td&gt;&lt;td width="125" align="LEFT" valign="TOP"&gt; &lt;/td&gt;&lt;td width="100%" align="LEFT" valign="TOP"&gt;Database name&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="115" align="LEFT" valign="TOP"&gt;datdba&lt;/td&gt;&lt;td width="67" align="LEFT" valign="TOP"&gt;&lt;span class="TYPE"&gt;int4&lt;/span&gt;&lt;/td&gt;&lt;td width="125" align="LEFT" valign="TOP"&gt;pg_shadow.usesysid&lt;/td&gt;&lt;td width="100%" align="LEFT" valign="TOP"&gt;Owner of the database, initially who created it&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="115" align="LEFT" valign="TOP"&gt;encoding&lt;/td&gt;&lt;td width="67" align="LEFT" valign="TOP"&gt;&lt;span class="TYPE"&gt;int4&lt;/span&gt;&lt;/td&gt;&lt;td width="125" align="LEFT" valign="TOP"&gt; &lt;/td&gt;&lt;td width="100%" align="LEFT" valign="TOP"&gt;Character/multibyte encoding for this database&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="115" align="LEFT" valign="TOP"&gt;datistemplate&lt;/td&gt;&lt;td width="67" align="LEFT" valign="TOP"&gt;&lt;span class="TYPE"&gt;bool&lt;/span&gt;&lt;/td&gt;&lt;td width="125" align="LEFT" valign="TOP"&gt; &lt;/td&gt;&lt;td width="100%" align="LEFT" valign="TOP"&gt;If true then this database can be used in the &lt;span class="QUOTE"&gt;"TEMPLATE"&lt;/span&gt; clause of &lt;tt class="COMMAND"&gt;CREATE DATABASE&lt;/tt&gt; to create the new database as a clone of this one.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="115" align="LEFT" valign="TOP"&gt;datallowconn&lt;/td&gt;&lt;td width="67" align="LEFT" valign="TOP"&gt;&lt;span class="TYPE"&gt;bool&lt;/span&gt;&lt;/td&gt;&lt;td width="125" align="LEFT" valign="TOP"&gt; &lt;/td&gt;&lt;td width="100%" align="LEFT" valign="TOP"&gt;If false then no one can connect to this database. This is used to protect the template0 database from being altered.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="115" align="LEFT" valign="TOP"&gt;datlastsysoid&lt;/td&gt;&lt;td width="67" align="LEFT" valign="TOP"&gt;&lt;span class="TYPE"&gt;oid&lt;/span&gt;&lt;/td&gt;&lt;td width="125" align="LEFT" valign="TOP"&gt; &lt;/td&gt;&lt;td width="100%" align="LEFT" valign="TOP"&gt;Last system OID in the database; useful particularly to &lt;b class="APPLICATION"&gt;pg_dump&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="115" align="LEFT" valign="TOP"&gt;datvacuumxid&lt;/td&gt;&lt;td width="67" align="LEFT" valign="TOP"&gt;&lt;span class="TYPE"&gt;xid&lt;/span&gt;&lt;/td&gt;&lt;td width="125" align="LEFT" valign="TOP"&gt; &lt;/td&gt;&lt;td width="100%" align="LEFT" valign="TOP"&gt;All tuples inserted or deleted by transaction IDs before this one have been marked as known committed or known aborted in this database. This is used to determine when commit-log space can be recycled.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="115" align="LEFT" valign="TOP"&gt;datfrozenxid&lt;/td&gt;&lt;td width="67" align="LEFT" valign="TOP"&gt;&lt;span class="TYPE"&gt;xid&lt;/span&gt;&lt;/td&gt;&lt;td width="125" align="LEFT" valign="TOP"&gt; &lt;/td&gt;&lt;td width="100%" align="LEFT" valign="TOP"&gt;All tuples inserted by transaction IDs before this one have been relabeled with a permanent (&lt;span class="QUOTE"&gt;"frozen"&lt;/span&gt;) transaction ID in this database. This is useful to check whether a database must be vacuumed soon to avoid transaction ID wraparound problems.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="115" align="LEFT" valign="TOP"&gt;datpath&lt;/td&gt;&lt;td width="67" align="LEFT" valign="TOP"&gt;&lt;span class="TYPE"&gt;text&lt;/span&gt;&lt;/td&gt;&lt;td width="125" align="LEFT" valign="TOP"&gt; &lt;/td&gt;&lt;td width="100%" align="LEFT" valign="TOP"&gt;If the database is stored at an alternative location then this records the location. It's either an environment variable name or an absolute path, depending how it was entered.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;Hence to list the database names, use the following query&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;SELECT datname FROM pg_database&lt;/span&gt;&lt;/blockquote&gt;Simple enough! So what's the problem you may ask. :)&lt;p&gt;&lt;/p&gt;&lt;p&gt;When you are trying to get a list of available databases, chances are you do not know the name of any database in that server to begin with. (Otherwise why would you run a query like that dah!). So now ask yourself against which database do you execute the query? Get the point?&lt;/p&gt;&lt;p&gt;That is where the default database comes in. From Postgre 8.1 onwards the server automatically creates a default database called &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;'postgres'&lt;/span&gt; hence the query can be executed against this.&lt;/p&gt;&lt;p&gt;In prior releases, the database &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;'template1'&lt;/span&gt; was used both as a default connection for utilities like createuser, and as a template for new databases. This caused CREATE DATABASE to sometimes fail, because a new database cannot be created if anyone else is in the template database. &lt;span class="Apple-style-span" style="font-weight: bold;"&gt;From v8.1, the default connection database is postgres&lt;/span&gt;, meaning it is much less likely someone will be using template1 during CREATE DATABASE.&lt;/p&gt;&lt;p&gt;Hence the template1 database can also be used to run the query if you need compatibility for all versions.&lt;/p&gt;&lt;p&gt;Hope this helps.&lt;/p&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-5912417625885639612?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=foJlq3XQD5k:MjVWElWfMek:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=foJlq3XQD5k:MjVWElWfMek:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=foJlq3XQD5k:MjVWElWfMek:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=foJlq3XQD5k:MjVWElWfMek:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=foJlq3XQD5k:MjVWElWfMek:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=foJlq3XQD5k:MjVWElWfMek:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=foJlq3XQD5k:MjVWElWfMek:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=foJlq3XQD5k:MjVWElWfMek:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=foJlq3XQD5k:MjVWElWfMek:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/foJlq3XQD5k" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/5912417625885639612/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=5912417625885639612" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/5912417625885639612?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/5912417625885639612?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/foJlq3XQD5k/postgre-sql-how-to-list-all-databases.html" title="Postgre SQL : How to List All Databases on a Postgre Server" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/10/postgre-sql-how-to-list-all-databases.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUDR3s-eCp7ImA9WxRRGUk.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-1176907877112049048</id><published>2008-10-02T15:47:00.008+05:30</published><updated>2008-10-02T16:14:36.550+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-02T16:14:36.550+05:30</app:edited><title>Crystal Reports: How to Share Data between Main Report and Sub Reports</title><content type="html">To share data between a Report and its sub reports in Crystal, you have to use shared variables.&lt;br /&gt;&lt;br /&gt;1. Create a formula field within each sub report which will contain the shared variable declaration and how it is used. The shared variable declaration (name and type)  should be the same in each field. i.e.&lt;br /&gt;&lt;blockquote&gt;Shared numberVar totalPoints;&lt;br /&gt;totalPoints := (leadsCountPerMonth/64) * 800;&lt;br /&gt;&lt;/blockquote&gt;2. Now Create a formula field which will also contain the same declaration of the shared variable in its definition. Then return the value of the shared variable as follows i.e.&lt;br /&gt;&lt;blockquote&gt;Shared numberVar totalPoints;&lt;br /&gt;totalPoints;&lt;br /&gt;&lt;/blockquote&gt;The most important thing to remember when using shared variables is that Crystal Reports must first evaluate the formula where the value is stored (in this case sub reports) before evaluating the formula that retrieves the shared variable (main report).&lt;br /&gt;&lt;br /&gt;i.e. Passing a grand total from the sub report to do a calculation in the main report will have you place the @MainReportFormula in a main report section that is beneath the section containing the subreport (i.e. Main Report Footer)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hope this helps.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-1176907877112049048?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=PTXHcmtHwRs:sCYp7X7jrNs:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=PTXHcmtHwRs:sCYp7X7jrNs:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=PTXHcmtHwRs:sCYp7X7jrNs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=PTXHcmtHwRs:sCYp7X7jrNs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=PTXHcmtHwRs:sCYp7X7jrNs:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=PTXHcmtHwRs:sCYp7X7jrNs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=PTXHcmtHwRs:sCYp7X7jrNs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=PTXHcmtHwRs:sCYp7X7jrNs:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=PTXHcmtHwRs:sCYp7X7jrNs:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/PTXHcmtHwRs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/1176907877112049048/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=1176907877112049048" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/1176907877112049048?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/1176907877112049048?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/PTXHcmtHwRs/crystal-reports-how-to-share-data.html" title="Crystal Reports: How to Share Data between Main Report and Sub Reports" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/10/crystal-reports-how-to-share-data.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUNR38-fip7ImA9WxRRFE8.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-395372677259717042</id><published>2008-09-26T15:21:00.006+05:30</published><updated>2008-09-26T15:48:16.156+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-26T15:48:16.156+05:30</app:edited><title>MS SQL Sever: How to SELECT TOP @RowCount</title><content type="html">MS SQL Server is sooo picky about what it lets developers use with statements such as select, insert, update, etc. I came across this issue when trying to select the top X number of rows from a table using TSQL. The X here is a variable value. Hence the first solution to popup in to your mind would be to&lt;br /&gt;&lt;blockquote&gt;SELECT TOP @RowCount&lt;br /&gt;FROM SomeTable&lt;/blockquote&gt;Well I'm here to tell you all that it doesn't work hehe. :p Apparently MS SQL Server doesn't allow variables to be used in that way along side statements such as select. The same goes for a scenario where you'd want to have a variable WHERE clause.&lt;br /&gt;&lt;blockquote&gt;SELECT [Col1], [Col2]&lt;br /&gt;FROM SomeTable&lt;br /&gt;WHERE @VariableWhereClause&lt;br /&gt;&lt;/blockquote&gt;One solution for this is to make the whole query a string and use the EXEC statement to execute the it as follows,&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SOLUTION 1&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;DECLARE @QueryString VARCHAR(MAX)&lt;br /&gt;&lt;br /&gt;SET @QueryString = 'SELECT TOP ' + @RowCount + ' FROM SomeTable'&lt;br /&gt;&lt;br /&gt;EXEC @QueryString&lt;/blockquote&gt;If @RowCount is not a VARCHAR variable (which it probably won't be) you may need to cast it into varchar before concatenation.&lt;br /&gt;&lt;br /&gt;Yeah! I know it looks dirty. So this is what I prefered to do instead,&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SOLUTION 2&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;SET ROWCOUNT @RowCount&lt;br /&gt;SELECT * FROM SomeTable&lt;br /&gt;SET ROWCOUNT 0&lt;br /&gt;&lt;/blockquote&gt;SET ROWCOUNT tells the server to stop processing after the number of rows specified by the @RowCount is met. Hence returning only that number of rows. But &lt;span style="font-weight: bold;"&gt;Remember to SET ROWCOUNT 0 immediately afterwards&lt;/span&gt; so that this action will be reset.&lt;br /&gt;&lt;br /&gt;Hope this helps.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-395372677259717042?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=qJL7TKIR75g:qv6xY3yGICU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=qJL7TKIR75g:qv6xY3yGICU:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=qJL7TKIR75g:qv6xY3yGICU:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=qJL7TKIR75g:qv6xY3yGICU:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=qJL7TKIR75g:qv6xY3yGICU:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=qJL7TKIR75g:qv6xY3yGICU:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=qJL7TKIR75g:qv6xY3yGICU:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=qJL7TKIR75g:qv6xY3yGICU:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=qJL7TKIR75g:qv6xY3yGICU:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/qJL7TKIR75g" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/395372677259717042/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=395372677259717042" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/395372677259717042?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/395372677259717042?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/qJL7TKIR75g/ms-sql-sever-how-to-select-top-rowcount.html" title="MS SQL Sever: How to SELECT TOP @RowCount" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/09/ms-sql-sever-how-to-select-top-rowcount.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEYDQXw-eSp7ImA9WxRTGEo.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-3970100132835386210</id><published>2008-09-08T15:40:00.020+05:30</published><updated>2008-09-08T16:39:30.251+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-08T16:39:30.251+05:30</app:edited><title>Crystal Reports : The Mystery of the Invisible Chart</title><content type="html">Crystal reports has a habit of giving developers headaches. But when you don't have anything better out there, you tend to stick to what you've got. My latest problem with Crystal Reports arose when I inserted a Chart into a report. Since it was a web based project (ASP.Net 2.0) I was kind of expecting for things to go wrong with it.&lt;br /&gt;&lt;br /&gt;The problem was that the chart was not being rendered in the browser at all, but when I exported it to PDF, presto! there it was. So I went over the page source using the browser and found out that the url to the chart image was a little something like,&lt;br /&gt;"http://localhost:49573/CrystalImageHandler.aspx?dynamicimage=imagename.png"&lt;br /&gt;&lt;br /&gt;So what or where was this mysterious CrystalImageHandler.aspx. Enter Google as always :)&lt;br /&gt;It seemed that I was missing the following line in the &lt;span style="font-weight: bold;"&gt;'httpHandlers'&lt;/span&gt; &lt;span style="font-weight: bold;"&gt;&lt;httphandlers&gt;&lt;/httphandlers&gt;&lt;/span&gt;section of my &lt;span style="font-weight: bold;"&gt;web.config&lt;/span&gt; file.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;httphandlers&gt;&lt;/httphandlers&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;add path="CrystalImageHandler.aspx" verb="GET" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"&gt;&lt;/add&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;add path="CrystalImageHandler.aspx" verb="GET" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"&gt;&lt;/add&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;add path="CrystalImageHandler.aspx" verb="GET" type="CrystalDecisions.Web.CrystalImageHandler, CrystalDecisions.Web, Version=10.2.3600.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This line is added automatically when you use the visual studio designer to drag and drop the report viewer. My project was using a Composite Control which contained the CrystalReportViewer in it and to add it, as I didn't use the designer, the line did not get added automatically.&lt;br /&gt;&lt;br /&gt;After adding the line, the chart got rendered perfectly. So remember to add the &lt;span style="font-weight: bold;"&gt;CrystalImageHandler&lt;/span&gt; line manually if you do not use the VS designer.&lt;br /&gt;&lt;br /&gt;Hope this helps.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-3970100132835386210?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=vyKcx3PTbGk:WRp24wou-H8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=vyKcx3PTbGk:WRp24wou-H8:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=vyKcx3PTbGk:WRp24wou-H8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=vyKcx3PTbGk:WRp24wou-H8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=vyKcx3PTbGk:WRp24wou-H8:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=vyKcx3PTbGk:WRp24wou-H8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=vyKcx3PTbGk:WRp24wou-H8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=vyKcx3PTbGk:WRp24wou-H8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=vyKcx3PTbGk:WRp24wou-H8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/vyKcx3PTbGk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/3970100132835386210/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=3970100132835386210" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/3970100132835386210?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/3970100132835386210?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/vyKcx3PTbGk/crystal-reports-mystery-of-invisible.html" title="Crystal Reports : The Mystery of the Invisible Chart" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/09/crystal-reports-mystery-of-invisible.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUMNQno5eSp7ImA9WxRTFU8.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-5402446828111914871</id><published>2008-09-04T16:35:00.005+05:30</published><updated>2008-09-04T16:54:53.421+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-04T16:54:53.421+05:30</app:edited><title>Displaying a Modal Browser Window via JavaScript</title><content type="html">&lt;p&gt;             A number of browsers (for example Netscape 4 or any             version of Opera up to and including version 9) do not             allow you to make a popup window modal at all. There is             simply no command that you can use that will make a             window modal in those browsers.           &lt;/p&gt;           &lt;p&gt;             There are two groups of browsers that do allow you to             create modal windows and each uses a different method             to do so.           &lt;/p&gt;           &lt;p&gt;             Internet Explorer adds an entirely new method to the             window object to open a modal window -             window.showModalDialog(). If you use that to try to             open a modal window then if your visitor is running             Internet Explorer then a modal window will be opened.             If they are running some other browser then all they             will get is a Javascript error.           &lt;/p&gt;                        The Mozilla based browsers (Netscape 6+, Firefox, etc)             use a completely different method to declare that the             window that is opened should stay in front . They use             the normal window.open and just add an extra attribute             modal=yes to the list of atributes that define the             appearance of the window.
&lt;br /&gt;
&lt;br /&gt;Hence a best of both worlds method would have to be adopted as follows,
&lt;br /&gt;&lt;blockquote&gt;function modalWin()
&lt;br /&gt;{
&lt;br /&gt;              &lt;b&gt;if (window.showModalDialog)
&lt;br /&gt;  {
&lt;br /&gt;                  window.showModalDialog("&lt;/b&gt;&lt;span style="font-weight: bold;"&gt;modalPage.html&lt;/span&gt;&lt;b&gt;","name", "dialogWidth:255px;dialogHeight:250px");
&lt;br /&gt;  }
&lt;br /&gt; else
&lt;br /&gt; {&lt;/b&gt;
&lt;br /&gt;                  window.open('modalPage.html','name', 'height=255,width=250,toolbar=no,directories=no,status=no, menubar=no,scrollbars=no,resizable=no&lt;b&gt;             ,modal=yes&lt;/b&gt;');
&lt;br /&gt;             &lt;b&gt;}&lt;/b&gt;
&lt;br /&gt;          }           &lt;/blockquote&gt;Next you may call the             modalWin function using a hyperlink like so.        
&lt;br /&gt;
&lt;br /&gt;a href="modalPage.htm"             target="name" onclick="&lt;b&gt;modalWin();&lt;/b&gt; return             false;"...........
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;Hope this helps.
&lt;br /&gt;        &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-5402446828111914871?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=RpGAQJJauW4:VtwJzk2NG80:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=RpGAQJJauW4:VtwJzk2NG80:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=RpGAQJJauW4:VtwJzk2NG80:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=RpGAQJJauW4:VtwJzk2NG80:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=RpGAQJJauW4:VtwJzk2NG80:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=RpGAQJJauW4:VtwJzk2NG80:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=RpGAQJJauW4:VtwJzk2NG80:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=RpGAQJJauW4:VtwJzk2NG80:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=RpGAQJJauW4:VtwJzk2NG80:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/RpGAQJJauW4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/5402446828111914871/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=5402446828111914871" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/5402446828111914871?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/5402446828111914871?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/RpGAQJJauW4/displaying-modal-browser-window-via.html" title="Displaying a Modal Browser Window via JavaScript" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/09/displaying-modal-browser-window-via.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEcARn4_fCp7ImA9WxRTFU8.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-2063202157224101550</id><published>2008-09-04T15:29:00.015+05:30</published><updated>2008-09-04T16:30:47.044+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-04T16:30:47.044+05:30</app:edited><title>TSQL : Understanding @@identity, scope_identity(), and ident_current()</title><content type="html">The need often arises to retrieve the value contained within an identity column of a newly inserted row just after insertion. Consider the following scenario.&lt;br /&gt;&lt;br /&gt;In a MSSQL database there are 2 tables, namely 'InvoiceHeader' and 'InvoiceDetails'.&lt;br /&gt;InvoiceHeader(InvNo(PK/Identity), InvDate, Discount)&lt;br /&gt;InvoiceDetails(InvNo, ItemNo, UnitPrice, Qty)&lt;br /&gt;&lt;br /&gt;Assume that the primary key column of the InvoiceHeader table 'InvNo' which is an identity column acts as a foreign key in the table 'InvoiceDetails'. Assume its a 1:M relationship. Hence when a new invoice is issued we need to insert a single record to the 'InvoiceHeader' and possibly multiple records to 'InvoiceDetails'.&lt;br /&gt;&lt;br /&gt;Inserting a new row to 'InvoiceHeader' would not be a problem and would look something like this,&lt;br /&gt;&lt;br /&gt;INSERT INTO InvoiceHeader (InvDate, Discount)&lt;br /&gt;VALUES ('1-Jan-2008', 100)&lt;br /&gt;&lt;br /&gt;Note that 'InvNo' is not specified since its an identity column.&lt;br /&gt;&lt;br /&gt;Next we need to add the item details of the invoice to InvoiceDetails table. To do that we need to know the 'InvNo' value of the newly inserted 'InvoiceHeader' row. To retrieve the newly created identity value in such a situation use the &lt;span style="font-weight: bold;"&gt;SCOPE_IDENTITY()&lt;/span&gt; function as follows.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;DECLARE @NewInvNo BIGINT&lt;br /&gt;&lt;br /&gt;INSERT INTO InvoiceHeader (InvDate, Discount)&lt;br /&gt;VALUES ('1-Jan-2008', 100)&lt;br /&gt;&lt;br /&gt;SET @NewInvNo = &lt;span style="font-weight: bold;"&gt;SCOPE_IDENTITY()&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;INSERT INTO InvoiceDetails (InvNo, ItemNo, UnitPrice, Qty)&lt;br /&gt;VALUES (@NewInvNo, 1, 99.90, 2)&lt;br /&gt;INSERT INTO InvoiceDetails (InvNo, ItemNo, UnitPrice, Qty)&lt;br /&gt; VALUES (@NewInvNo, 10, 150.00, 4)&lt;/blockquote&gt;Add the above tsql code in a stored procedure and you are good to go.&lt;br /&gt;&lt;br /&gt;Although &lt;span style="font-weight: bold;"&gt;SCOPE_IDENTITY() &lt;/span&gt;maybe used most of the time there are two other confusingly similar options in TSQL which are &lt;span style="font-weight: bold;"&gt;@@identity &lt;/span&gt;and&lt;span style="font-weight: bold;"&gt; ident_current()&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Before diving into these two, we need to understand some keywords first.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;strong&gt;Session&lt;/strong&gt; - This means the current connection that's executing the command.&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;strong&gt;Scope&lt;/strong&gt; - This means the immediate context of a command. Every stored procedure call executes in its own scope, and nested calls execute in a nested scope within the calling procedure's scope.&lt;/li&gt;&lt;/ul&gt;Here are the differences between the three identity retrieval methods,&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;@@identity&lt;/span&gt; returns the last identity value generated in &lt;em&gt;this&lt;/em&gt; &lt;strong&gt;session&lt;/strong&gt; but &lt;em&gt;any&lt;/em&gt; &lt;strong&gt;scope&lt;/strong&gt;  &lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;scope_identity()&lt;/span&gt; returns the last identity value generated in &lt;em&gt;this&lt;/em&gt; &lt;strong&gt;session&lt;/strong&gt; and &lt;em&gt;this&lt;/em&gt; &lt;strong&gt;scope&lt;/strong&gt;  &lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;ident_current()&lt;/span&gt; returns the last identity value generated for a particular table in &lt;em&gt;any&lt;/em&gt; &lt;strong&gt;session&lt;/strong&gt; and &lt;em&gt;any&lt;/em&gt; &lt;strong&gt;scope&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;Hope this helps.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-2063202157224101550?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=D5TQSqzUYTE:OP7OalthI9o:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=D5TQSqzUYTE:OP7OalthI9o:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=D5TQSqzUYTE:OP7OalthI9o:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=D5TQSqzUYTE:OP7OalthI9o:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=D5TQSqzUYTE:OP7OalthI9o:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=D5TQSqzUYTE:OP7OalthI9o:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=D5TQSqzUYTE:OP7OalthI9o:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=D5TQSqzUYTE:OP7OalthI9o:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=D5TQSqzUYTE:OP7OalthI9o:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/D5TQSqzUYTE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/2063202157224101550/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=2063202157224101550" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/2063202157224101550?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/2063202157224101550?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/D5TQSqzUYTE/tsql-understanding-identity.html" title="TSQL : Understanding @@identity, scope_identity(), and ident_current()" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/09/tsql-understanding-identity.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUYHSXo8fip7ImA9WxdWFUQ.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-8353024742751199441</id><published>2008-07-09T13:45:00.010+05:30</published><updated>2008-07-09T14:15:38.476+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-07-09T14:15:38.476+05:30</app:edited><title>DateTime in MS SQL Server : Till Death Do They Part</title><content type="html">Microsoft SQL Server 2005 and earlier versions do not provide a data type for storing date values or time values seperately. Instead it stores them together in a data type called 'DateTime'. However filtering out only the date part from such a datetime value has sparked many a debate in forums which often result in lengthy threads that confuse the reader rather than provide a solution.&lt;br /&gt;&lt;br /&gt;MS SQL server does not provide an inbuilt function for this task. Hence all solutions are workarounds invented by developers like you and me :) . Most solutions depend on casting the datetime value to varchar or to some other character based data type and then seperating the date part using string manipulation functions. This method is prone to errors since it does not take into consideration that datetime values can be in many formats depending on the locale selected. Parsing a casted dateformat value using string methods while taking into consideration all the possible datetime formats is pretty difficult and IMHO absurd.&lt;br /&gt;&lt;br /&gt;In addition, at the end of the day the casted string date value will again have to be casted back to DateTime format if it is to be compared with another datetime value or to be used in a datetime function.&lt;br /&gt;&lt;br /&gt;Hence I found the following method (which does not utilize any casting hence returns a datetime value too) to be very satisfying indeed. It's not as lengthy as most solutions mentioned earlier too. Just one line of code :)&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;DATEADD(dd, 0, DATEDIFF(dd, 0, @YourDateTimeValueHere))&lt;/blockquote&gt;All you have to do is replace "@YourDateTimeValueHere" with your datetime value and you are good to go.&lt;br /&gt;&lt;br /&gt;Hope this helps,&lt;br /&gt;&lt;br /&gt;Harindaka.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-8353024742751199441?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=7LcvBKnbGoM:VGRNnJGWHMw:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=7LcvBKnbGoM:VGRNnJGWHMw:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=7LcvBKnbGoM:VGRNnJGWHMw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=7LcvBKnbGoM:VGRNnJGWHMw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=7LcvBKnbGoM:VGRNnJGWHMw:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=7LcvBKnbGoM:VGRNnJGWHMw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=7LcvBKnbGoM:VGRNnJGWHMw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=7LcvBKnbGoM:VGRNnJGWHMw:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=7LcvBKnbGoM:VGRNnJGWHMw:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/7LcvBKnbGoM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/8353024742751199441/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=8353024742751199441" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/8353024742751199441?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/8353024742751199441?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/7LcvBKnbGoM/datetime-in-ms-sql-server-till-death-do.html" title="DateTime in MS SQL Server : Till Death Do They Part" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/07/datetime-in-ms-sql-server-till-death-do.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUICRHo5eip7ImA9WxdWEEU.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-8915729966683997367</id><published>2008-07-03T16:42:00.001+05:30</published><updated>2008-07-03T16:42:45.422+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-07-03T16:42:45.422+05:30</app:edited><title>CultureInfo : So You Think You Can Code!</title><content type="html">&lt;p&gt;The CultureInfo class is often used to acquire culture specific information from the system to make the users feel at home. When most .Net developers use &lt;strong&gt;CultureInfo.CurrentCulture&lt;/strong&gt; property to do so, they think  they've done it. Well I used to be one of them. Not any more.... lol :)&lt;/p&gt; &lt;p&gt;Let me get straight to the point. Of-course the users have the option to select their culture from the Regional Settings applet in the Windows Control Panel. But the thing is that's not all they are allowed to do. They can also customize the properties of each culture i.e. They can select the current culture as "en-Us" and set the short date format to "dd-MMM-yy" which is a whole lot different than the default short date format for that culture which is "m/dd/yyyy".&lt;/p&gt; &lt;p&gt;Let's assume that the user selected the system culture to be "en-US" and changed the default short date format for that Culture which is "m/dd/yyyy" to "dd-MM-yy". &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;The above code returns the current short date format in the system right?  WRONG!&lt;/p&gt; &lt;p&gt;It only returns the default short date format ("m/dd/yyyy") for the current culture (in this case "en-US"), not the changed short date pattern ("dd-MM-yy") that you expect.&lt;/p&gt; &lt;p&gt;How to fix it?&lt;/p&gt; &lt;p&gt;You need to instantiate the CultureInfo class using the constructor:&lt;/p&gt; &lt;blockquote&gt;&lt;pre&gt;&lt;strong&gt;public CultureInfo(&lt;br /&gt;  int culture,&lt;br /&gt;  bool useUserOverride&lt;br /&gt;)&lt;/strong&gt;&lt;/pre&gt;&lt;/blockquote&gt; &lt;p&gt;This Initializes a new instance of the CultureInfo class based on the culture specified by the culture identifier and on the Boolean that specifies whether to use the user-selected culture settings from the system.&lt;/p&gt; &lt;p&gt;Setting the parameter useUserOverride to true ensures that whatever settings the user changed will be returned when accessing the newly instantiated CultureInfo object's properties. Therefore the proper code is as follows.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;CultureInfo ci = new CultureInfo(CultureInfo.CurrentCulture.LCID,  true);&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;string shortDatePattern =  ci.DateTimeFormat.ShortDatePattern;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Hope this helps.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-8915729966683997367?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=4LDdsE9USUs:q2IswzwFMyA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=4LDdsE9USUs:q2IswzwFMyA:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=4LDdsE9USUs:q2IswzwFMyA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=4LDdsE9USUs:q2IswzwFMyA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=4LDdsE9USUs:q2IswzwFMyA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=4LDdsE9USUs:q2IswzwFMyA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=4LDdsE9USUs:q2IswzwFMyA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=4LDdsE9USUs:q2IswzwFMyA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=4LDdsE9USUs:q2IswzwFMyA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/4LDdsE9USUs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/8915729966683997367/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=8915729966683997367" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/8915729966683997367?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/8915729966683997367?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/4LDdsE9USUs/cultureinfo-so-you-think-you-can-code.html" title="CultureInfo : So You Think You Can Code!" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/07/cultureinfo-so-you-think-you-can-code.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0cHQ3o9fyp7ImA9WxdWEEU.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-7737978858166951406</id><published>2008-07-03T15:57:00.001+05:30</published><updated>2008-07-03T16:00:32.467+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-07-03T16:00:32.467+05:30</app:edited><title>How to Response.Redirect to a New Browser Window</title><content type="html">&lt;p&gt;This is one of the most frequently asked questions in ASP.NET Forums. Most  will tell you that you cant. That is true but not completely. This is because  server side script does not have any power over the web browser. Hence Java  Script's window.open() function will have to be used. The trick is how you  inject the JavaScript back in to the response. Here's how I did it :) The code  is in C#, hope you won't mind.&lt;/p&gt; &lt;span style="font-size:85%;"&gt; &lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;public static void RedirectToNewWindow(string url, string windowFeatures)&lt;/p&gt; &lt;p&gt;{&lt;/p&gt; &lt;p&gt;HttpContext context = HttpContext.Current;&lt;/p&gt; &lt;p&gt;Page currentPage = (Page)HttpContext.Current.Handler;&lt;/p&gt;  &lt;p&gt; &lt;/p&gt; &lt;p&gt;if (currentPage == null)&lt;/p&gt; &lt;p&gt;throw new InvalidOperationException("Cannot redirect to new window outside  Page context.");&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;url = currentPage.ResolveClientUrl(url);&lt;/p&gt;  &lt;p&gt;string script;&lt;/p&gt; &lt;p&gt; &lt;/p&gt; &lt;p&gt;if (!String.IsNullOrEmpty(windowFeatures))&lt;/p&gt; &lt;p&gt;script = @"window.open(""{0}"", ""{1}"", ""{2}"");";&lt;/p&gt; &lt;p&gt;else&lt;/p&gt; &lt;p&gt;script = @"window.open(""{0}"", ""{1}"");";&lt;/p&gt;  &lt;p&gt; &lt;/p&gt; &lt;p&gt;script = String.Format(script, url, "_blank", windowFeatures);&lt;/p&gt;  &lt;p&gt;ScriptManager.RegisterStartupScript(currentPage, typeof(Page), "Redirect",  script, true); &lt;/p&gt; &lt;p&gt;}&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt; &lt;p&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;/blockquote&gt;The windowsFeatures parameter can be passed a null string if you do not need  to control the new window's width, height, etc. However please remember that you  cannot call this function outside Page Context since ScriptManager needs the  page to register the script.&lt;p&gt;&lt;/p&gt; &lt;p&gt;Hope this helps.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-7737978858166951406?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=PskHyzWMOj4:CSaQKDXgxds:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=PskHyzWMOj4:CSaQKDXgxds:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=PskHyzWMOj4:CSaQKDXgxds:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=PskHyzWMOj4:CSaQKDXgxds:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=PskHyzWMOj4:CSaQKDXgxds:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=PskHyzWMOj4:CSaQKDXgxds:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=PskHyzWMOj4:CSaQKDXgxds:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=PskHyzWMOj4:CSaQKDXgxds:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=PskHyzWMOj4:CSaQKDXgxds:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/PskHyzWMOj4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/7737978858166951406/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=7737978858166951406" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/7737978858166951406?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/7737978858166951406?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/PskHyzWMOj4/how-to-responseredirect-to-new-browser.html" title="How to Response.Redirect to a New Browser Window" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/07/how-to-responseredirect-to-new-browser.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkADSHc7eyp7ImA9WxZbFEw.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-946712860354491823</id><published>2008-04-17T13:22:00.001+05:30</published><updated>2008-04-17T13:22:59.903+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-04-17T13:22:59.903+05:30</app:edited><title>.NET Setup &amp; Deployment Project - Unrecoverable Error - Not so unrecoverable after all!</title><content type="html">&lt;p&gt;I came across the dreaded &amp;quot;Unrecoverable Error&amp;quot; when compiling a ASP.NET project. The reason why I used the word dreaded is because Visual Studio 2005 does not display any details regarding this error except for the two words &amp;quot;Unrecoverable error&amp;quot;. The developer is left dumbfounded and pretty much frustrated. Where Microsoft leaves off Google usually picks up. Hence after some googling I found out that I wasn't alone. i.e. the link below.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=128028&amp;amp;SiteID=1" target="_blank"&gt;http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=128028&amp;amp;SiteID=1&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Additionally unlike most bugs in Visual Studio 2005, this could not be resolved simply by cleaning and rebuilding the solution or rebooting the PC. Although &lt;a href="http://support.microsoft.com/kb/329214/EN-US/" target="_blank"&gt;Microsoft has proposed multiple solutions&lt;/a&gt; to this scenario which includes registry editing and re-registering &lt;span class="userInput"&gt;&amp;quot;C:\Program Files\Common Files\Microsoft Shared\MSI Tools\mergemod.dll&amp;quot; via &lt;span id="_ctl0_MainContent_PostFlatView"&gt;&lt;span&gt;regsvr32,&lt;/span&gt;&lt;/span&gt; none worked for me (at least not completely that is). It should be noted that I didn't go into editing the registry (God knows what that would have resulted in :-O)&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="userInput"&gt;So it seems that Microsoft's proposed solution of re-registering mergmod.dll was not complete but only a part of it. According to the earlier mentioned thread, I also registered &lt;span id="_ctl0_MainContent_PostFlatView"&gt;&lt;span&gt;ole32.dll and presto! the project built without any errors.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="userInput"&gt;&lt;span id="_ctl0_MainContent_PostFlatView"&gt;&lt;span&gt;So the solution in a nutshell is as follows,&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span class="userInput"&gt;&lt;span id="_ctl0_MainContent_PostFlatView"&gt;&lt;span&gt;Using Start &amp;gt; Run execute the following commands.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;&lt;span class="userInput"&gt;&lt;span id="_ctl0_MainContent_PostFlatView"&gt;&lt;span&gt;&lt;span class="userInput"&gt;regsvr32 &amp;quot;C:\Program Files\Common Files\Microsoft Shared\MSI Tools\mergemod.dll&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;    &lt;li&gt;&lt;span class="userInput"&gt;&lt;span id="_ctl0_MainContent_PostFlatView"&gt;&lt;span&gt;&lt;span id="_ctl0_MainContent_PostFlatView"&gt;&lt;span&gt;&lt;span id="_ctl0_MainContent_PostFlatView"&gt;&lt;span&gt;regsvr32 ole32.dll&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;span class="userInput"&gt;&lt;span id="_ctl0_MainContent_PostFlatView"&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;Hope this helps.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-946712860354491823?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=_nIKZmXmxmQ:iWuxamt2O5k:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=_nIKZmXmxmQ:iWuxamt2O5k:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=_nIKZmXmxmQ:iWuxamt2O5k:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=_nIKZmXmxmQ:iWuxamt2O5k:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=_nIKZmXmxmQ:iWuxamt2O5k:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=_nIKZmXmxmQ:iWuxamt2O5k:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=_nIKZmXmxmQ:iWuxamt2O5k:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=_nIKZmXmxmQ:iWuxamt2O5k:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=_nIKZmXmxmQ:iWuxamt2O5k:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/_nIKZmXmxmQ" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/946712860354491823/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=946712860354491823" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/946712860354491823?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/946712860354491823?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/_nIKZmXmxmQ/net-setup-deployment-project.html" title=".NET Setup &amp;amp; Deployment Project - Unrecoverable Error - Not so unrecoverable after all!" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/04/net-setup-deployment-project.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck4MSH87fSp7ImA9WxZbFEw.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-8446201529903303645</id><published>2008-04-17T11:13:00.001+05:30</published><updated>2008-04-17T11:13:09.105+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-04-17T11:13:09.105+05:30</app:edited><title>How to Add MIME Types in Microsoft IIS Server 6.0 / Introduce Office 2007 Documents to IIS 6.0</title><content type="html">&lt;p&gt;Usually in order to figure out the type of file being uploaded to IIS, ASP.NET developers have the option of comparing its the file's MIME type to any existing entry in the IIS server's MIME Types list. Since Office 2007 was released after Windows Server 2003 and IIS6, IIS6 does not recognize the new MIME types of such files as *.docx, *.xlsx, etc. Hence you need to manually add them as follows: &lt;/p&gt;  &lt;p&gt;1. Open Computer Management. (Right-click My Computer... Manage...) &lt;/p&gt;  &lt;p&gt;2. Right-click Internet Information Services (IIS) Management... Properties... &lt;/p&gt;  &lt;p&gt;3. Click MIME Types... &lt;/p&gt;  &lt;p&gt;4. Click New... and add the following: &lt;/p&gt;  &lt;table cellspacing="0" cellpadding="2" width="759" border="1"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td valign="top" width="113"&gt;Extension&lt;/td&gt;        &lt;td valign="top" width="642"&gt;MIME Type&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="113"&gt;.xlsx&lt;/td&gt;        &lt;td valign="top" width="642"&gt;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="113"&gt;.xltx&lt;/td&gt;        &lt;td valign="top" width="642"&gt;application/vnd.openxmlformats-officedocument.spreadsheetml.template&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="113"&gt;.potx&lt;/td&gt;        &lt;td valign="top" width="642"&gt;application/vnd.openxmlformats-officedocument.presentationml.template&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="113"&gt;.ppsx&lt;/td&gt;        &lt;td valign="top" width="642"&gt;application/vnd.openxmlformats-officedocument.presentationml.slideshow&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="113"&gt;.pptx&lt;/td&gt;        &lt;td valign="top" width="642"&gt;application/vnd.openxmlformats-officedocument.presentationml.presentation&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="113"&gt;.sldx&lt;/td&gt;        &lt;td valign="top" width="642"&gt;application/vnd.openxmlformats-officedocument.presentationml.slide&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="113"&gt;.docx&lt;/td&gt;        &lt;td valign="top" width="642"&gt;application/vnd.openxmlformats-officedocument.wordprocessingml.document&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="113"&gt;.dotx&lt;/td&gt;        &lt;td valign="top" width="642"&gt;application/vnd.openxmlformats-officedocument.wordprocessingml.template&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="113"&gt;.xlam&lt;/td&gt;        &lt;td valign="top" width="642"&gt;application/vnd.ms-excel.addin.macroEnabled.12&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td valign="top" width="113"&gt;.xlsb&lt;/td&gt;        &lt;td valign="top" width="642"&gt;application/vnd.ms-excel.sheet.binary.macroEnabled.12&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;It should be noted that these MIME Types have been added in IIS 7.&lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-8446201529903303645?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=ABG1OU5VHYY:msOuFJkk0I0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=ABG1OU5VHYY:msOuFJkk0I0:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=ABG1OU5VHYY:msOuFJkk0I0:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=ABG1OU5VHYY:msOuFJkk0I0:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=ABG1OU5VHYY:msOuFJkk0I0:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=ABG1OU5VHYY:msOuFJkk0I0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=ABG1OU5VHYY:msOuFJkk0I0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=ABG1OU5VHYY:msOuFJkk0I0:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=ABG1OU5VHYY:msOuFJkk0I0:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/ABG1OU5VHYY" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/8446201529903303645/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=8446201529903303645" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/8446201529903303645?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/8446201529903303645?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/ABG1OU5VHYY/how-to-add-mime-types-in-microsoft-iis.html" title="How to Add MIME Types in Microsoft IIS Server 6.0 / Introduce Office 2007 Documents to IIS 6.0" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/04/how-to-add-mime-types-in-microsoft-iis.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU4BRnw4eCp7ImA9WxZQEEo.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-465768381826169377</id><published>2008-02-15T16:42:00.001+05:30</published><updated>2008-02-15T16:42:37.230+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-02-15T16:42:37.230+05:30</app:edited><title>How to Guard Against SQL Injection Attacks</title><content type="html">&lt;p&gt;Many developers are still unaware of the possibility of their code falling prey to SQL Injection attacks which can result in devastating consequences. Good programming practices however can minimize this possibility. The wikipedia defines an SQL Injection Attack as follows;&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;SQL injection is a technique that exploits a &lt;a href="http://en.wikipedia.org/wiki/Security_vulnerability" target="_blank"&gt;security vulnerability&lt;/a&gt; occurring in the &lt;a href="http://en.wikipedia.org/wiki/Database" target="_blank"&gt;database&lt;/a&gt; layer of an &lt;a href="http://en.wikipedia.org/wiki/Application_software" target="_blank"&gt;application&lt;/a&gt;. The vulnerability is present when user input is either incorrectly filtered for &lt;a href="http://en.wikipedia.org/wiki/String_literal" target="_blank"&gt;string literal&lt;/a&gt; &lt;a href="http://en.wikipedia.org/wiki/Escape_sequences" target="_blank"&gt;escape characters&lt;/a&gt; embedded in &lt;a href="http://en.wikipedia.org/wiki/SQL" target="_blank"&gt;SQL&lt;/a&gt; statements or user input is not &lt;a href="http://en.wikipedia.org/wiki/Strong_type" target="_blank"&gt;strongly typed&lt;/a&gt; and thereby unexpectedly executed.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Let me explain via an example. Lets say you as a developer wrote a login application. Let's also assume that you use string concatenation to check whether the input username and password exists in the database. Hence your code may look as follows,&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;string sql = &amp;quot;SELECT * FROM Users WHERE UserID = &amp;quot; + txtUserID.Text + &amp;quot; AND Password = '&amp;quot; + txtPassword.Text + &amp;quot;'&amp;quot;;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;(txtUserID and txtPassword being the two text boxes into which the user inputs the user id and password. Also assume that the database table column UserID is of type int.)&lt;/p&gt;  &lt;p&gt;If you are thinking &amp;quot;so what?&amp;quot; then you should read on.&lt;/p&gt;  &lt;p&gt;Imagine what would happen if the user inputs the following in the txtUserID textbox,&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;1 OR 10=10 -- &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;The resulting SQL statement would be: SELECT * FROM Users WHERE UserID = 1 OR 10=10 &lt;font color="#008040"&gt;-- AND Password = '' &lt;/font&gt;&lt;/p&gt;  &lt;p&gt;The important part here is the double dash (--). As you know in MS SQL Server, the double dash comments out whatever follows it. Hence the part &lt;strong&gt;&lt;font color="#008000"&gt;AND Password = ''&lt;/font&gt;&lt;/strong&gt; will be commented out leaving only the following statement to be processed as the actual query.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;SELECT * FROM Users WHERE UserID = 1 OR 10=10&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now you are starting to get the picture aren't you? Obviously this will select all user records from the table Users since 10 is equal to 10. Hence if you depended on the count of the returned rows being greater than zero (checking whether the user exists in the table) condition to see whether it's a successful login, the user will be able to login to the system without breaking a sweat. In other words you are the victim of a classic SQL Injection Attack.&lt;/p&gt;  &lt;p&gt;Now the all important question: How do you make sure that this doesn't happen?&lt;/p&gt;  &lt;p&gt;Solution: Using Parameterized SQL Stored Procedures. Creating parameterized stored procedures and accessing them from code not only prevents SQL Injection Attacks, it&amp;#xA0; is also very easy to do. Just take a look at the following tutorial.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://support.microsoft.com/kb/320916" target="_blank"&gt;http://support.microsoft.com/kb/320916&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Oh and last but not least, the increase in performance gained by using parameterized stored procedures instead of string concatenation will be an added advantage.&lt;/p&gt;  &lt;p&gt;Hope this helps.&lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-465768381826169377?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=9S6Ei0zrLKk:X56q0wSNWSk:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=9S6Ei0zrLKk:X56q0wSNWSk:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=9S6Ei0zrLKk:X56q0wSNWSk:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=9S6Ei0zrLKk:X56q0wSNWSk:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=9S6Ei0zrLKk:X56q0wSNWSk:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=9S6Ei0zrLKk:X56q0wSNWSk:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=9S6Ei0zrLKk:X56q0wSNWSk:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=9S6Ei0zrLKk:X56q0wSNWSk:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=9S6Ei0zrLKk:X56q0wSNWSk:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/9S6Ei0zrLKk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/465768381826169377/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=465768381826169377" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/465768381826169377?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/465768381826169377?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/9S6Ei0zrLKk/how-to-guard-against-sql-injection.html" title="How to Guard Against SQL Injection Attacks" /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>4</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/02/how-to-guard-against-sql-injection.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEYDSXs-fip7ImA9WxZREkU.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-449972326103052998</id><published>2008-02-06T12:46:00.001+05:30</published><updated>2008-02-06T12:46:18.556+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-02-06T12:46:18.556+05:30</app:edited><title>How to Probe a Dynamically Loaded .NET Assembly for Interface Implementations.</title><content type="html">&lt;p&gt;The following code demonstrates how to probe a dynamically loaded .NET assembly (&amp;quot;C:\TestAssembly.dll&amp;quot;) for all classes which implement a specified interface (ITestInterface), instantiate them and invoke a method (TestMethod()) defined in that interface.&lt;/p&gt;  &lt;p&gt;First lets look at the interface definition.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff" size="2"&gt;public&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;interface&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;ITestInterface&lt;/font&gt;&lt;/p&gt;   &lt;font size="2"&gt;     &lt;p&gt;{&lt;/p&gt;      &lt;p&gt;&lt;/p&gt;     &lt;font color="#0000ff" size="2"&gt;&lt;font color="#2b91af"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;float&lt;/font&gt;&lt;font size="2"&gt; TestMethod(&lt;/font&gt;&lt;font size="2"&gt;);&lt;/font&gt;       &lt;p&gt;}&lt;/p&gt;   &lt;/font&gt;&lt;/blockquote&gt;  &lt;p&gt;The following code will load and probe the assembly C:\TestAssembly.dll for implementations of the above mentioned ITestInterface and invoke its TestMethod() method.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;font color="#0000ff" size="2"&gt;private &lt;font color="#0000ff" size="2"&gt;void&lt;/font&gt;&lt;font size="2"&gt; Invoke()&lt;/font&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt; &lt;/font&gt;&lt;/p&gt;    &lt;p&gt;{&lt;/p&gt;   &lt;font color="#008000" size="2"&gt;     &lt;p&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; //Loading Assembly&lt;/p&gt;   &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;&lt;/font&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; Assembly&lt;/font&gt;&lt;font size="2"&gt; ass = LoadAssembly(&lt;font color="#a31515"&gt;&amp;quot;C:\\TestAssembly.dll&amp;quot;&lt;/font&gt;);&lt;/font&gt; &lt;/p&gt;    &lt;p&gt;&lt;/p&gt;   &lt;font color="#2b91af" size="2"&gt;&lt;font color="#008000" size="2"&gt;       &lt;p&gt;&lt;font color="#2b91af"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;//Fetching all types in that assembly&lt;/p&gt;     &lt;/font&gt;&lt;/font&gt;    &lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; Type&lt;/font&gt;&lt;font size="2"&gt;[] types = ass.GetTypes();&lt;/font&gt; &lt;/p&gt;    &lt;p&gt;&lt;/p&gt;   &lt;font color="#0000ff" size="2"&gt;&lt;font color="#2b91af"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;object&lt;/font&gt;&lt;font size="2"&gt; obj;&lt;/font&gt;     &lt;p&gt;&lt;/p&gt;   &lt;font color="#0000ff" size="2"&gt;&lt;font color="#2b91af"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;string&lt;/font&gt;&lt;font size="2"&gt; interfaceType = &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;typeof&lt;/font&gt;&lt;font size="2"&gt;(&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;ITestInterface&lt;/font&gt;&lt;font size="2"&gt;).FullName;&lt;/font&gt;     &lt;p&gt;&lt;/p&gt;   &lt;font color="#0000ff" size="2"&gt;&lt;font color="#2b91af"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;if&lt;/font&gt;&lt;font size="2"&gt; (types != &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;     &lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;{&lt;/p&gt;   &lt;font color="#008000" size="2"&gt;     &lt;p&gt;&lt;font color="#2b91af"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;//Checking whether the ITestInterface is implemented by each type and if so invoking the TestMethod() method.&lt;/p&gt;      &lt;p&gt;&lt;/p&gt;     &lt;font color="#0000ff" size="2"&gt;&lt;font color="#2b91af"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;foreach&lt;/font&gt;&lt;font size="2"&gt; (&lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;Type&lt;/font&gt;&lt;font size="2"&gt; t &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;in&lt;/font&gt;&lt;font size="2"&gt; types)&lt;/font&gt; &lt;/font&gt;    &lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;{&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;   &lt;font color="#0000ff" size="2"&gt;&lt;font color="#2b91af"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;if&lt;/font&gt;&lt;font size="2"&gt; (t.GetInterface(interfaceType) != &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;font size="2"&gt;)&lt;/font&gt;     &lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;{&lt;/p&gt;    &lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;obj=ass.CreateInstance(t.FullName);&lt;/p&gt;    &lt;p&gt;&lt;font color="#0000ff" size="2"&gt;&lt;font color="#2b91af"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;float &lt;/font&gt;retval = (&lt;font color="#0000ff" size="2"&gt;float&lt;/font&gt;) t.InvokeMember(&lt;font color="#a31515" size="2"&gt;&amp;quot;TestMethod&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;, &lt;/font&gt;&lt;font color="#2b91af" size="2"&gt;BindingFlags&lt;/font&gt;&lt;font size="2"&gt;.InvokeMethod, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;font size="2"&gt;, obj, &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;null&lt;/font&gt;&lt;font size="2"&gt;);&lt;/font&gt; &lt;/p&gt;    &lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;}&lt;/p&gt;    &lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;}&lt;/p&gt;    &lt;p&gt;&lt;font color="#2b91af" size="2"&gt;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0;&amp;#xA0; &lt;/font&gt;}&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;   &lt;font size="2"&gt;     &lt;p&gt;}&lt;/p&gt;   &lt;/font&gt;    &lt;p&gt;&amp;#xA0;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Hope this helps :)&lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-449972326103052998?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=g_TuUxY-y24:jt-n0I7OUeY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=g_TuUxY-y24:jt-n0I7OUeY:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=g_TuUxY-y24:jt-n0I7OUeY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=g_TuUxY-y24:jt-n0I7OUeY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=g_TuUxY-y24:jt-n0I7OUeY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=g_TuUxY-y24:jt-n0I7OUeY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=g_TuUxY-y24:jt-n0I7OUeY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=g_TuUxY-y24:jt-n0I7OUeY:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=g_TuUxY-y24:jt-n0I7OUeY:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/g_TuUxY-y24" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/449972326103052998/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=449972326103052998" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/449972326103052998?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/449972326103052998?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/g_TuUxY-y24/how-to-probe-dynamically-loaded-net.html" title="How to Probe a Dynamically Loaded .NET Assembly for Interface Implementations." /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/02/how-to-probe-dynamically-loaded-net.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8FQXg4fCp7ImA9WxZREUQ.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-2984863389644586184</id><published>2008-02-05T12:03:00.001+05:30</published><updated>2008-02-05T12:30:10.634+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-02-05T12:30:10.634+05:30</app:edited><title>Detecting the Build Configuration (Debug/Release) in a .NET Application.</title><content type="html">&lt;p&gt;Sometimes the need arises to differentiate between the debug/release mode of a .Net application from within the code itself. This is evident specially when dynamically loading assemblies in a .Net application since the path of the assembly being loaded, may vary according to the debug/release mode. Hence you need come up with working code for both modes.&lt;/p&gt;  &lt;p&gt;Enter &lt;strong&gt;#if DEBUG&lt;/strong&gt;. The #if DEBUG section in .Net allows developers to write code which cater to both situations as follows. i.e.,&lt;/p&gt; &lt;font color="#0000ff" size="2"&gt;   &lt;p&gt;private &lt;font color="#2b91af" size="2"&gt;Assembly&lt;/font&gt;&lt;font size="2"&gt; LoadAssembly()&lt;/font&gt;&lt;/p&gt;    &lt;p&gt;{&lt;/p&gt;    &lt;p&gt;&lt;/p&gt;   &lt;font color="#2b91af" size="2"&gt;Assembly&lt;/font&gt;&lt;font size="2"&gt; a;&lt;/font&gt;     &lt;p&gt;&lt;/p&gt;   &lt;font color="#0000ff" size="2"&gt;string&lt;/font&gt;&lt;font size="2"&gt; assemblyPath;&lt;/font&gt;     &lt;p&gt;&lt;/p&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;   &lt;p&gt;#if &lt;font size="2"&gt;DEBUG&lt;/font&gt; &lt;/p&gt;    &lt;p&gt;assemblyPath = &lt;font color="#a31515" size="2"&gt;&amp;quot;E:\\ExampleProjects\\LoadAssemblyTest\\TestAssembly\\bin\\Debug\\TestAssembly.dll&amp;quot;&lt;/font&gt;&lt;font size="2"&gt;;&lt;/font&gt;&lt;/p&gt;   &lt;font color="#0000ff" size="2"&gt; &lt;/font&gt;    &lt;p&gt;#else&lt;/p&gt; &lt;/font&gt;&lt;font color="#808080" size="2"&gt;   &lt;p&gt;assemblyPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, &amp;quot;TestAssembly.dll&amp;quot;);&lt;/p&gt; &lt;/font&gt;&lt;font color="#0000ff" size="2"&gt;   &lt;p&gt;#endif&lt;/p&gt; &lt;/font&gt;&lt;font size="2"&gt;   &lt;p&gt;a = &lt;font color="#2b91af" size="2"&gt;Assembly&lt;/font&gt;&lt;font size="2"&gt;.LoadFile(assemblyPath);&lt;/font&gt; &lt;/p&gt;    &lt;p&gt;&lt;/p&gt;   &lt;font color="#0000ff" size="2"&gt;return&lt;/font&gt;&lt;font size="2"&gt; a;&lt;/font&gt;     &lt;p&gt;}&lt;/p&gt; &lt;/font&gt;  &lt;p&gt;Here the code will load the assembly from &lt;span style="font-size: 85%; color: #a31515"&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;&amp;quot;E:\ExampleProjects\LoadAssemblyTest\TestAssembly\bin\Debug\TestAssembly.dll&amp;quot; &lt;span style="color: #000000"&gt;if the application is in debug mode. This is because the line &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;assemblyPath=&amp;quot;E:\\ExampleProjects\\LoadAssemblyTest\\TestAssembly\\bin\\Debug\\TestAssembly.dll&amp;quot;;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 85%; color: #a31515"&gt;&lt;font size="2"&gt;&lt;font color="#000000"&gt;&lt;span style="color: #000000"&gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-size: 85%; color: #a31515"&gt;&lt;span style="color: #000000"&gt;&lt;span style="font-size: 85%"&gt;&lt;font size="2"&gt;is written inside #if DEBUG section. Similarly the code will try to load the assembly from the current execution path if the application is in release mode. Note that this line&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;span style="font-size: 85%; color: #a31515"&gt;&lt;span style="color: #000000"&gt;&lt;span style="font-size: 85%"&gt;&lt;font size="2"&gt;         &lt;p&gt;assemblyPath= Path.Combine(AppDomain.CurrentDomain.BaseDirectory, &amp;quot;TestAssembly.dll&amp;quot;);&lt;/p&gt;       &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;  &lt;p&gt;&lt;span style="font-size: 85%; color: #a31515"&gt;&lt;span style="color: #000000"&gt;&lt;span style="font-size: 85%"&gt;&lt;font size="2"&gt;is grayed out. This is because the mode is currently set to DEBUG in Visual Studio. Hence the compiler ignores it.&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;&lt;span style="font-size: 85%; color: #a31515"&gt;&lt;span style="color: #000000"&gt;&lt;span style="font-size: 85%"&gt;&lt;font size="2"&gt;Hope this helps :-)&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-2984863389644586184?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=gxN1Qy_WDbk:O27Lg48rCr8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=gxN1Qy_WDbk:O27Lg48rCr8:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=gxN1Qy_WDbk:O27Lg48rCr8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=gxN1Qy_WDbk:O27Lg48rCr8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=gxN1Qy_WDbk:O27Lg48rCr8:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=gxN1Qy_WDbk:O27Lg48rCr8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=gxN1Qy_WDbk:O27Lg48rCr8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=gxN1Qy_WDbk:O27Lg48rCr8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=gxN1Qy_WDbk:O27Lg48rCr8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/gxN1Qy_WDbk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/2984863389644586184/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=2984863389644586184" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/2984863389644586184?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/2984863389644586184?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/gxN1Qy_WDbk/detecting-build-configuration.html" title="Detecting the Build Configuration (Debug/Release) in a .NET Application." /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/02/detecting-build-configuration.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcFSH8-cSp7ImA9WxZTFk4.&quot;"><id>tag:blogger.com,1999:blog-2382683355806754646.post-8730791444199356637</id><published>2008-01-18T12:00:00.001+05:30</published><updated>2008-01-18T12:03:39.159+05:30</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-01-18T12:03:39.159+05:30</app:edited><title>Exception : The SqlParameter is already contained by another SqlParameterCollection.</title><content type="html">&lt;p&gt;I came across this rather odd yet frustrating exception today while developing a reporting module which extracts data from several parameterized MS SQL Server stored procedures. I didn't bother to create new instances of the SQLParameter class for each query since these multiple procedures used the same set of parameters. It made no sense since my data access layer automatically closed the database connection immediately after each query. So why was the runtime complaining that an SQLParameter instance was being shared among two collections? After a little googling I came across the following post. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://blog.benhall.me.uk/2007/04/sqlparameter-is-already-contained-by.html" target="_blank"&gt;Ben Hall's Blog: The SqlParameter is already contained by another SqlParameterCollection.&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Ben Hall's assumption is that although the database connection is closed immediately after a query, the SQLParameterCollection of the SQLCommand involved in it is not disposed of by the .Net Garbage Collector before the next query takes place. This is because Garbage Collection is a background process. Hence its asynchronous relative to the current process. So many other solutions I came across suggested calling SQLCommand.Dispose() immediately after each query to force the .Net Garbage Collector to dispose the SQLCommand object before the next query. Yet I found Ben's solution more appealing, which was to clear the SQLParameterCollection of the SQLCommand after each query.&lt;/p&gt;  &lt;p&gt;Solution: SQLCommandObject.Parameters.Clear();&lt;/p&gt;  &lt;p&gt;After adding this line at the end of the query in the data access layer, life was back to normal.&lt;/p&gt;  &lt;p&gt;Hope this helps.&lt;/p&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2382683355806754646-8730791444199356637?l=harindaka.blogspot.com' alt='' /&gt;&lt;/div&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=Gv9DPDjSWIM:oDDYcD2gTa0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=Gv9DPDjSWIM:oDDYcD2gTa0:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=Gv9DPDjSWIM:oDDYcD2gTa0:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=Gv9DPDjSWIM:oDDYcD2gTa0:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=Gv9DPDjSWIM:oDDYcD2gTa0:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=Gv9DPDjSWIM:oDDYcD2gTa0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=Gv9DPDjSWIM:oDDYcD2gTa0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/harindaka?a=Gv9DPDjSWIM:oDDYcD2gTa0:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/harindaka?i=Gv9DPDjSWIM:oDDYcD2gTa0:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/harindaka/~4/Gv9DPDjSWIM" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://harindaka.blogspot.com/feeds/8730791444199356637/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=2382683355806754646&amp;postID=8730791444199356637" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/8730791444199356637?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/2382683355806754646/posts/default/8730791444199356637?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/harindaka/~3/Gv9DPDjSWIM/exception-sqlparameter-is-already.html" title="Exception : The SqlParameter is already contained by another SqlParameterCollection." /><author><name>harindaka</name><uri>http://www.blogger.com/profile/15300545055362161743</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://harindaka.blogspot.com/2008/01/exception-sqlparameter-is-already.html</feedburner:origLink></entry></feed>

