<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8287829162475847446</id><updated>2012-02-16T21:46:53.749-06:00</updated><category term='asp'/><category term='xml'/><category term='data recovery'/><category term='mail'/><category term='iis'/><category term='charts'/><category term='design patterns'/><category term='reports'/><category term='office'/><category term='web'/><category term='registry'/><category term='SQL Server'/><category term='PSP'/><category term='messaging'/><category term='MSMQ'/><category term='skype'/><category term='VB.NET'/><category term='data conversion'/><category term='disk'/><category term='windows server'/><category term='julian'/><category term='spinrite'/><category term='quick reference'/><category term='Java'/><category term='sybase'/><category term='windows XP'/><category term='C#'/><category term='tcp'/><category term='powerbuilder'/><category term='excel'/><category term='text'/><category term='web service'/><category term='telnet'/><category term='dates'/><category term='internet'/><category term='.net'/><category term='performance'/><category term='utilities'/><title type='text'>IT Toolshed</title><subtitle type='html'>Collection of useful tips</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>38</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-8651560811463653832</id><published>2008-06-04T01:05:00.001-05:00</published><updated>2008-06-04T01:05:52.928-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>SQL Server 2005 CTE (Common Table Expression)</title><content type='html'>SQL Server 2005 CTE (Common Table Expression)&lt;br /&gt;&lt;br /&gt;By Bihag Thaker&lt;br /&gt;   &lt;br /&gt;CTE is a new feature provided by Microsoft SQL Server 2005. In real world, we often need to query hierarchical data from the database. For example, to get a list of hierarchical list of all the employees, list of product categories etc. CTE fulfills this requirement and let us query the database recursively.&lt;br /&gt;&lt;br /&gt;Demo Builder - Create Flash Presentations&lt;br /&gt;Create interactive Flash movies that allow you to show how applications and systems work.  Download a FREE trial now.&lt;br /&gt;&lt;br /&gt;Let’s us do this practically. Assume that we store different categories of computer books and any category can have sub-categories. For this, we will create a table named tblCategories with the following structure and insert some categories into this table as shown below:&lt;br /&gt;&lt;br /&gt;Create Table tblCategories&lt;br /&gt;(&lt;br /&gt;CategoryID Int Constraint PK_tblCategories_CategoryID Primary Key,&lt;br /&gt;CategoryName VarChar(100),&lt;br /&gt;ParentCategoryID Int Constraint FK_tblCategories_ParentCategoryID References tblCategories(CategoryID)&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;Insert Into tblCategories(CategoryID,CategoryName,ParentCategoryID) Values(1,'Languages',Null)&lt;br /&gt;&lt;br /&gt;Insert Into tblCategories(CategoryID,CategoryName,ParentCategoryID) Values(2,'Networking',Null)&lt;br /&gt;&lt;br /&gt;Insert Into tblCategories(CategoryID,CategoryName,ParentCategoryID) Values(3,'Databases',Null)&lt;br /&gt;&lt;br /&gt;Insert Into tblCategories(CategoryID,CategoryName,ParentCategoryID) Values(4,'Visual Basic',1)&lt;br /&gt;&lt;br /&gt;Insert Into tblCategories(CategoryID,CategoryName,ParentCategoryID) Values(5,'C#',1)&lt;br /&gt;&lt;br /&gt;Insert Into tblCategories(CategoryID,CategoryName,ParentCategoryID) Values(6,'Java',1)&lt;br /&gt;&lt;br /&gt;Insert Into tblCategories(CategoryID,CategoryName,ParentCategoryID) Values(7,'VB.Net',4)&lt;br /&gt;&lt;br /&gt;Insert Into tblCategories(CategoryID,CategoryName,ParentCategoryID) Values(8,'VB 6.0',4)&lt;br /&gt;&lt;br /&gt;Insert Into tblCategories(CategoryID,CategoryName,ParentCategoryID) Values(9,'Desktop Application Development with VB.Net',7)&lt;br /&gt;&lt;br /&gt;Insert Into tblCategories(CategoryID,CategoryName,ParentCategoryID) Values(10,'Web Application Development with VB.Net',7)&lt;br /&gt;&lt;br /&gt;Insert Into tblCategories(CategoryID,CategoryName,ParentCategoryID) Values(11,'ActiveX Objects and VB 6.0',8)&lt;br /&gt;&lt;br /&gt;Insert Into tblCategories(CategoryID,CategoryName,ParentCategoryID) Values(12,'Network Security',2)&lt;br /&gt;&lt;br /&gt;Now if you query the database with the following SELECT command,&lt;br /&gt;&lt;br /&gt;Select * From tblCategories Where CategoryID = 1&lt;br /&gt;&lt;br /&gt;You will get the following result:&lt;br /&gt;&lt;br /&gt;CategoryID CategoryName ParentCategoryID&lt;br /&gt;----------- ---------------- ----------------&lt;br /&gt;1 Languages NULL&lt;br /&gt;&lt;br /&gt;(1 row(s) affected)&lt;br /&gt;&lt;br /&gt;No surprise! But what, if you want to get the list of all the categories/sub-categories falling under the root category ‘Languages’? To do this, you will need to perform a recursive query and to do that we use CTE.&lt;br /&gt;&lt;br /&gt;Let’s do this with the help of CTE. To create CTE we will use the following syntax:&lt;br /&gt;&lt;br /&gt;With cteCategories&lt;br /&gt;AS (&lt;br /&gt;Select CategoryID,CategoryName,ParentCategoryID&lt;br /&gt;From tblCategories&lt;br /&gt;Where CategoryID=1&lt;br /&gt;&lt;br /&gt;Union All&lt;br /&gt;&lt;br /&gt;Select C.CategoryID,C.CategoryName,C.ParentCategoryID&lt;br /&gt;From tblCategories As C Inner Join cteCategories As P On C.ParentCategoryID = P.CategoryID&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;&lt;br /&gt;Select CategoryID,CategoryName,ParentCategoryID From cteCategories&lt;br /&gt;&lt;br /&gt;Run the above query and see the result as shown below:&lt;br /&gt;&lt;br /&gt;CategoryID CategoryName ParentCategoryID&lt;br /&gt;----------- ---------------------------------------------------- ----------------&lt;br /&gt;1 Languages NULL&lt;br /&gt;4 Visual Basic 1&lt;br /&gt;5 C# 1&lt;br /&gt;6 Java 1&lt;br /&gt;7 VB.Net 4&lt;br /&gt;8 VB 6.0 4&lt;br /&gt;11 ActiveX Objects and VB 6.0 8&lt;br /&gt;9 Desktop Application Development with VB.Net 7&lt;br /&gt;10 Web Application Development with VB.Net 7&lt;br /&gt;&lt;br /&gt;(9 row(s) affected)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-8651560811463653832?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.eggheadcafe.com/tutorials/aspnet/c5c48628-5f72-4132-b0cf-b15d65b91c9c/sql-server-2005-cte-comm.aspx' title='SQL Server 2005 CTE (Common Table Expression)'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/8651560811463653832/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=8651560811463653832&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/8651560811463653832'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/8651560811463653832'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/06/sql-server-2005-cte-common-table.html' title='SQL Server 2005 CTE (Common Table Expression)'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-8069010690819331743</id><published>2008-06-04T01:04:00.001-05:00</published><updated>2008-06-04T01:04:50.958-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>SQL Server 2005 Paging Performance Tip</title><content type='html'>SQL Server 2005 Paging Performance Tip&lt;br /&gt;&lt;br /&gt;By Robbe Morris&lt;br /&gt;&lt;br /&gt;This quick tip demonstrates how to get the total rows as part of the paging query as well as how avoid a common coding error with joins that can harm performance.&lt;br /&gt;&lt;br /&gt;Demo Builder - Create Flash Presentations&lt;br /&gt;Create interactive Flash movies that allow you to show how applications and systems work.  Download a FREE trial now.&lt;br /&gt;&lt;br /&gt;I've seen the following technique in several beginner code samples for demonstrating SQL Server 2005's ability to return paged results.&lt;br /&gt;&lt;br /&gt;I've added the TotalRows = Count(*) OVER() line to demonstrate how return the total rows returned above and beyond the row count for the paged set.  This removes the need for a second query to get the total rows available for paging techniques in your application.  In your application, just check to make sure your resultset has records, then just grab the first record and retrieve its TotalRows column value.&lt;br /&gt;&lt;br /&gt;Notice that in this query, the JOIN between the Orders table and the Users table is being run across all records that are found NOT just the records returned in the paged set.&lt;br /&gt;&lt;br /&gt;  declare @StartRow int&lt;br /&gt;  declare @MaxRows int&lt;br /&gt;&lt;br /&gt;  select @StartRow = 1&lt;br /&gt;  select @MaxRows = 10&lt;br /&gt;&lt;br /&gt;   select *&lt;br /&gt;     from&lt;br /&gt;     (select o.*,u.FirstName,u.LastName,&lt;br /&gt;         TotalRows=Count(*) OVER(),&lt;br /&gt;         ROW_NUMBER() OVER(ORDER BY o.CreateDateTime desc) as RowNum&lt;br /&gt;         from Orders o , Users u&lt;br /&gt;   WHERE o.CreateDateTime &gt; getdate() -30&lt;br /&gt;        AND (o.UserID = u.UserID)&lt;br /&gt;     )&lt;br /&gt;     WHERE RowNum BETWEEN @StartRow AND (@StartRow + @MaxRows) -1&lt;br /&gt;&lt;br /&gt;If you adjust your query as follows, you will see a substantial boost in performance.  Notice this query only performs the join on the returned resultset which is much, much smaller.&lt;br /&gt;&lt;br /&gt;SELECT MyTable.*,u.FirstName,u.LastName&lt;br /&gt;FROM&lt;br /&gt;   (SELECT o.*,&lt;br /&gt;       TotalRows=Count(*) OVER(),&lt;br /&gt;       ROW_NUMBER() OVER(ORDER BY o.CreateDateTime desc) as RowNum&lt;br /&gt;    FROM Orders o&lt;br /&gt;    WHERE o.CreateDateTime &gt; getdate() -30&lt;br /&gt;   ) as MyTable, Users u&lt;br /&gt;WHERE RowNum BETWEEN @StartRow AND (@StartRow + @MaxRows) -1&lt;br /&gt;  and (MyTable.UserID = u.UserID)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-8069010690819331743?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.eggheadcafe.com/tutorials/aspnet/fe1e8749-26dd-4db7-9c18-b6ea5c39aa73/sql-server-2005-paging-pe.aspx' title='SQL Server 2005 Paging Performance Tip'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/8069010690819331743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=8069010690819331743&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/8069010690819331743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/8069010690819331743'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/06/sql-server-2005-paging-performance-tip.html' title='SQL Server 2005 Paging Performance Tip'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-5284996192343611486</id><published>2008-05-23T16:58:00.001-05:00</published><updated>2008-05-23T16:58:31.270-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='powerbuilder'/><title type='text'>10 PowerBuilder Pitfalls</title><content type='html'>First the good news: PowerBuilder is a great tool; in  fact you can't&lt;br /&gt;accidentally do much wrong. This&lt;br /&gt;strength is based on a  number of reasons. The following is list of why&lt;br /&gt;I think PowerBuilder is so  great, but&lt;br /&gt;you might like to add one or two more items to it:&lt;br /&gt;PowerScript  is simple; it's easy to learn because of its clearly&lt;br /&gt;laid out  grammar.&lt;br /&gt;PowerScript is a strongly typed language; many problems&lt;br /&gt;simply  don't arise because of the compiler telling you about  an&lt;br /&gt;error.&lt;br /&gt;PowerScript is easy to read. PowerBuilder itself takes care  of&lt;br /&gt;the tedious task of correct indentation. Thus PowerBuilder&lt;br /&gt;programs  look pretty much the same in terms of "layout" in all&lt;br /&gt;PowerBuilder shops  around the world.&lt;br /&gt;There is no pointer system. You cannot access addresses of  objects and&lt;br /&gt;do nasty things with them.&lt;br /&gt;PowerBuilder does all the low-level  memory management for you. There's&lt;br /&gt;no need to allocate and&lt;br /&gt;dealloacate  memory for strings or arrays, as it's done for you. When&lt;br /&gt;using objects,  garbage collection&lt;br /&gt;cleans up after you.&lt;br /&gt;No dangling pointers. All  references to a single object become invalid&lt;br /&gt;whenever the the object  is&lt;br /&gt;destroyed and can be checked by using IsValid().&lt;br /&gt;Values of simple data  types are initialized - numeric values with&lt;br /&gt;zero, Booleans with FALSE,  etc.&lt;br /&gt;Those elements are part of the strength of PowerBuilder (plus  the&lt;br /&gt;DataWindow, of course). However, there&lt;br /&gt;are a few pitfalls in  PowerBuilder programming that seem to frequently&lt;br /&gt;occur. This article will  show you&lt;br /&gt;some of those issues. I have collected them over time in my  function&lt;br /&gt;as technical lead where I do a lot of&lt;br /&gt;code review and  "programmers first-level support" as I repeatedly come&lt;br /&gt;across the same  problems. For&lt;br /&gt;some of the problems, I'll propose a workaround to make your  programs&lt;br /&gt;safer. Let's start.&lt;br /&gt;1. Find With Wrong Parameters&lt;br /&gt;What's wrong  with the following piece of code?&lt;br /&gt;l_max = ds.RowCount()&lt;br /&gt;l_index =  ds.Find('x&gt;5', 1, l_max)&lt;br /&gt;DO WHILE l_index &gt;  0&lt;br /&gt;of_WorkOn(l_index)&lt;br /&gt;l_index = ds.Find('x&gt;5', l_index + 1,  l_max)&lt;br /&gt;LOOP&lt;br /&gt;Answer: It hides a potential endless loop - Find() can  search&lt;br /&gt;backwards! If the value in column x is greater&lt;br /&gt;than 5 in the last  row of the DataStore, l_index will eventually&lt;br /&gt;become l_max. The Find() will  read:&lt;br /&gt;l_index = ds.Find('x&gt;5', l_max + 1, l_max)&lt;br /&gt;PowerBuilder  recognizes that l_max + 1 is greater than l_max and will&lt;br /&gt;start to search  backwards. Of course,&lt;br /&gt;it will find the row l_max that fits the expression.  The perfect&lt;br /&gt;endless loop is done.&lt;br /&gt;HOW TO AVOID PITFALL 1:&lt;br /&gt;This behavior  is documented and thus won't change. What can we do&lt;br /&gt;about it? There are two  workarounds:&lt;br /&gt;Page 2&lt;br /&gt;Always code the Find finishing not at RowCount(), but  at RowCount() + 1.&lt;br /&gt;Implement a function Find in your DataWindow or DataStore  ancestor&lt;br /&gt;class that only takes two&lt;br /&gt;arguments: the expression and the  starting row. Within the function&lt;br /&gt;use the solution stated above.&lt;br /&gt;2.  Incorrect Boolean DataWindow Expressions&lt;br /&gt;This pitfall is really a major  problem if programmers are not aware of&lt;br /&gt;it, so be warned.  PowerBuilder&lt;br /&gt;supports two language grammars: PowerScript and DataWindow  Expression&lt;br /&gt;syntax. Many functions known&lt;br /&gt;from PowerScript are available  within DataWindow expressions as well,&lt;br /&gt;so it's easy for us to code in  each&lt;br /&gt;of them. But beware, there are some subtle and very important  differences.&lt;br /&gt;Whats's wrong with the following expression?&lt;br /&gt;NOT IsNull(x)  AND x &gt; 100&lt;br /&gt;Nothing really. At least if you use it within PowerScript,  PowerScript&lt;br /&gt;will evaluate it to&lt;br /&gt;(NOT IsNull(x)) AND (x &gt; 100)&lt;br /&gt;But  take care: if you use the same expression within a DataWindow (for&lt;br /&gt;Find,  Filter, etc.), PowerBuilder&lt;br /&gt;will evaluate it to:&lt;br /&gt;NOT (IsNull(x) AND (x  &gt; 100))&lt;br /&gt;therefore evaluating it to FALSE, because a value cannot be NULL  and&lt;br /&gt;greater than 100 at the same time.&lt;br /&gt;What is the reason for  that?&lt;br /&gt;DataWindow expressions have a different operator precedence  for&lt;br /&gt;logical operators compared to&lt;br /&gt;PowerScript (and just about any other  computer language I know).&lt;br /&gt;Usually NOT has precedence over AND,&lt;br /&gt;and AND  has precedence over OR. But within DataWindow expressions, AND&lt;br /&gt;and OR have  precedence&lt;br /&gt;over NOT. AND and OR will be evaluated in the order of how they  occur.&lt;br /&gt;This is very weird, but still is expected and documented  behavior.&lt;br /&gt;Simply start PowerBuilder help and&lt;br /&gt;search for  "operators:precedence", and you'll find the two diverging&lt;br /&gt;styles of logical  operator precedence&lt;br /&gt;within PowerBuilder.&lt;br /&gt;HOW TO AVOID PITFILL 2:&lt;br /&gt;The  only way you can get around this problem is to use brackets to&lt;br /&gt;tell PB  explicitly what you mean. For&lt;br /&gt;the example above you'll need to write:&lt;br /&gt;(NOT  IsNull(x)) AND (x &gt; 100)&lt;br /&gt;3.Missing Message Boxes&lt;br /&gt;Sometimes we use  MessageBoxes for "quick and dirty" debugging. Once in&lt;br /&gt;a while a programmer  tells me&lt;br /&gt;that PowerBuilder is not showing message boxes anymore. Take a look  at&lt;br /&gt;the next code snippet; what could&lt;br /&gt;be wrong here?&lt;br /&gt;s_data =  ds.GetItemString(1, 'data')&lt;br /&gt;MessageBox('data is', s_data)&lt;br /&gt;The reason that  PowerBuilder doesn't show the MessageBox is simple:&lt;br /&gt;s_data is null! And  PowerBuilder&lt;br /&gt;does with MessageBox just about the same thing it does with all  other&lt;br /&gt;functions that are being called with&lt;br /&gt;nulls as arguments: it does not  execute the function but returns null.&lt;br /&gt;HOW TO AVOID PITFALL 3:&lt;br /&gt;Page  3&lt;br /&gt;The workaround for that is simple, but involves some work on your&lt;br /&gt;side:  you need to code your own&lt;br /&gt;version of function MessageBox (for instance as a  global function).&lt;br /&gt;You can't override PowerBuilder&lt;br /&gt;built-in functions  without losing the ability to call them, so you&lt;br /&gt;need to give the function a  new name, say&lt;br /&gt;MsgBox. The problem is that there is a wealth of overloaded  versions&lt;br /&gt;of MessageBox functions, so you&lt;br /&gt;need to implement quite a few.  Within each of the calls, check the&lt;br /&gt;arguments for nulls.&lt;br /&gt;4. Not Fully  Regenerated Source Code&lt;br /&gt;Sometimes people in the Sybase newsgroups complain  that PowerBuilder&lt;br /&gt;is slow and not stable. More often&lt;br /&gt;than not, the reason  for that is the source code is not thoroughly&lt;br /&gt;regenerated. This has been  especially true&lt;br /&gt;for the early versions of PB 7, where a change within the  source of a&lt;br /&gt;function changed the order of the&lt;br /&gt;function list in the source  code, which in turn led to incorrect&lt;br /&gt;functions being called if you did  not&lt;br /&gt;regenerate all depending (i.e., calling) classes.&lt;br /&gt;HOW TO AVOID PITFALL  4:&lt;br /&gt;The workaround for this is simple: let computers do the dirty work  for&lt;br /&gt;you. Do a nightly regeneration of&lt;br /&gt;your sources either with OrcaScript  or any of the third-party tools&lt;br /&gt;that focus on that kind of task.&lt;br /&gt;5.  Passing Objects per Reference&lt;br /&gt;This is not really a pitfall but rather an  aesthetic issue: many&lt;br /&gt;developers apparently still believe that they&lt;br /&gt;need  to pass objects "by reference" in order to be able to change&lt;br /&gt;their instance  variables. This is wrong,&lt;br /&gt;PowerBuilder does not pass the object but only the  object reference&lt;br /&gt;per reference. The only time you'll need&lt;br /&gt;this is when you  change the object reference in the called function&lt;br /&gt;(for example, because you  create or&lt;br /&gt;re-create it).&lt;br /&gt;HOW TO AVOID PITFALL 5:&lt;br /&gt;That's an easy one:  simply use pass by value for objects.&lt;br /&gt;6. New DataWindow Columns Are Not  Updatable by Default&lt;br /&gt;A PowerBuilder classic - I guess just about every  programmer tripped&lt;br /&gt;over this behavior at least once in his&lt;br /&gt;or her career.  Whenever you add a column to a table, you need to add&lt;br /&gt;it to the DataWindow  result set in&lt;br /&gt;order to retrieve it from the database. That's the simple part.  But,&lt;br /&gt;the newly added columns are not&lt;br /&gt;updatable by default. PowerBuilder  used to give those columns a tab&lt;br /&gt;order of 0, so you couldn't edit  the&lt;br /&gt;column. However, with more recent builds, newly added columns get  the&lt;br /&gt;highest tab order, so you are able&lt;br /&gt;to edit the columns right away. The  bad part: those columns won't be&lt;br /&gt;saved until you manually add them to&lt;br /&gt;the  list using the "update properties" dialog.&lt;br /&gt;HOW TO AVOID PITFALL 6:&lt;br /&gt;Always  remember to edit the update properties when you add a column.&lt;br /&gt;7. Using  ClipBoard in a DataWindow&lt;br /&gt;Is the function ClipBoard not working for you? It  might be because you&lt;br /&gt;use it within a DataWindow.&lt;br /&gt;Sometimes the clipboard  is used to store interim values. Using&lt;br /&gt;ClipBoard(s_data) within  DataWindow&lt;br /&gt;source code is not successful, because the function ClipBoard  is&lt;br /&gt;implemented within the class DataWindow&lt;br /&gt;with different semantics and  thus hides the global function ClipBoard.&lt;br /&gt;The result is that the data you  want to&lt;br /&gt;put in the clipboard simply isn't there.&lt;br /&gt;HOW TO AVOID PITFALL  7:&lt;br /&gt;When trying to access the clipboard in DataWindow sources,  explicitly&lt;br /&gt;use the global operator :: and&lt;br /&gt;Page 4&lt;br /&gt;therefore write  ::ClipBoard(s_data).&lt;br /&gt;8. SetItemStatus Needs Intermediate Step&lt;br /&gt;This is also  a PowerBuilder classic but is already well known: there&lt;br /&gt;are some item  statuses that can't be set&lt;br /&gt;directly; you need a second SetItemStatus to  achieve the goal. One&lt;br /&gt;example: changing the column status&lt;br /&gt;from "new" to  "notModified" simply doesn't work. You need to set it to&lt;br /&gt;"dataModified"  first, then you can&lt;br /&gt;change it to "notModified". Some others settings are  allowed, but&lt;br /&gt;don't work as expected; changing from&lt;br /&gt;"newModified" to  "notModified" will change the state to '"new".&lt;br /&gt;HOW TO AVOID PITFALL  8:&lt;br /&gt;Whenever you implement SetItemStatus, check with the PB online help&lt;br /&gt;for  the "SetItemStatus method" if&lt;br /&gt;the combination is to be successful. Do an  intermediate step if necessary.&lt;br /&gt;9. No Runtime Error for Incorrect SetItems or  SetFilters&lt;br /&gt;If you issue an incorrect GetItemX on a DataWindow, PowerBuilder  will&lt;br /&gt;raise an error if you used a wrong&lt;br /&gt;row, a wrong column name, or a  wrong data type for the column.&lt;br /&gt;Unfortunately, there will be no  runtime&lt;br /&gt;errors for incorrect SetItem commands. You need to check the  return&lt;br /&gt;code of the function yourself. The&lt;br /&gt;same holds true for SetFilter. I  believe these two functions to be&lt;br /&gt;some of the most important ones for  PB&lt;br /&gt;scripts as they can influence the flow of execution and the stored  data.&lt;br /&gt;HOW TO AVOID PITFALL 9:&lt;br /&gt;In your ancestor classes for DataStore and  DataWindow, override all&lt;br /&gt;SetItems and SetFilters and raise an&lt;br /&gt;exception if  there is an error. You will make your programs much more robust.&lt;br /&gt;10. No Data  After Retrieve&lt;br /&gt;Retrieving data in a datastore doesn't always mean that you  have the&lt;br /&gt;read rows available in the primary&lt;br /&gt;buffer. While any experienced  PowerBuilder programmer will know this,&lt;br /&gt;it is a common source of&lt;br /&gt;problems  for newbies. PowerBuilder applies the filter expression&lt;br /&gt;defined in the  DataWindow painter after it&lt;br /&gt;has read the data. So it may happen that you read  loads of data and&lt;br /&gt;the return value of Retrieve is zero! Why&lt;br /&gt;is that? The  answer is simple: the return value of Retrieve is the&lt;br /&gt;number of rows in the  primary buffer after&lt;br /&gt;the Retrieve, not the number of rows retrieved. The two  numbers (rows&lt;br /&gt;retrieved versus rows in primary&lt;br /&gt;buffer) might be different  in two cases:&lt;br /&gt;There is a filter expression defined that filters some  data.&lt;br /&gt;PowerBuilder applies the filter after having&lt;br /&gt;read the rows. You will  find those rows in the filter buffer of  your&lt;br /&gt;DataWindow/Datastore.&lt;br /&gt;1.&lt;br /&gt;You returned 2 in RetrieveStart, thus not  emptying the buffers before&lt;br /&gt;the read. If there had been rows&lt;br /&gt;before the  Retrieve, the return value of Retrieve will be the sum of&lt;br /&gt;existing rows and  newly read&lt;br /&gt;rows.&lt;br /&gt;2.&lt;br /&gt;HOW TO AVOID PITFALL 10:&lt;br /&gt;Just be aware of the  fact. You might want to remove the built-in&lt;br /&gt;filter and do a SetFilter() and  Filter in&lt;br /&gt;source code (which is much more readable  anyway).&lt;br /&gt;Summary&lt;br /&gt;PowerBuilder has only a few gotchas you need to know in  order to write&lt;br /&gt;reliable software. The 10 pitfalls&lt;br /&gt;mentioned above are my  personal list of items to be aware of. Keeping&lt;br /&gt;those in mind when programming  or&lt;br /&gt;- even better - taking care of them in your base classes will help  you&lt;br /&gt;write a robust application.&lt;br /&gt;Do you know of any other issues I didn't  mention here? Please drop me&lt;br /&gt;a brief note - if I get enough&lt;br /&gt;Page  5&lt;br /&gt;feedback, I'll compile those issues into another PBDJ article.&lt;br /&gt;&lt;a href="http://www.romu.com/"&gt;www.romu.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-5284996192343611486?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.romu.com/download/10_powerbuilder_pitfalls.pdf' title='10 PowerBuilder Pitfalls'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/5284996192343611486/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=5284996192343611486&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/5284996192343611486'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/5284996192343611486'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/05/10-powerbuilder-pitfalls.html' title='10 PowerBuilder Pitfalls'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-6395331038985622429</id><published>2008-05-23T16:56:00.001-05:00</published><updated>2008-05-23T16:59:43.583-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='powerbuilder'/><title type='text'>Combining PowerBuilder Help Files</title><content type='html'>Combining PowerBuilder Help Files&lt;br /&gt;&lt;br /&gt;Wouldn't it be nice if all of the help  files were combined so you&lt;br /&gt;could hit Shift-F1 on a PB, PFC, or Corporate  Extension function and&lt;br /&gt;have it automatically come up?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Well now  you can! Just do the following:&lt;br /&gt;&lt;br /&gt;   * Open pbhlpxx.cnt in Notepad (or any  other text editor) and add&lt;br /&gt;the following lines immediately after :Title  PowerBuilder Help (the&lt;br /&gt;second line):&lt;br /&gt;         :Index PFC  Help=pbpfcxx.hlp&lt;br /&gt;         :Index Corporate Extension  Help=CorpExtn.hlp&lt;br /&gt;         :Link pbpfcxx.hlp&lt;br /&gt;:Link  CorpExtn.hlp&lt;br /&gt;:Include pbpfcxx.cnt&lt;br /&gt;:Include  CorpExtn.cnt&lt;br /&gt;   * Save and close the file&lt;br /&gt;   * Make sure all of the  *.hlp files you have included reside in the&lt;br /&gt;Help folder of your PowerBuilder  installation&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.romu.com/download/10_powerbuilder_pitfalls.pdf"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-6395331038985622429?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.ecocion.com/Articles/SybasePowerBuilder/CombiningPBHelpFiles.html' title='Combining PowerBuilder Help Files'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/6395331038985622429/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=6395331038985622429&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/6395331038985622429'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/6395331038985622429'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/05/combining-powerbuilder-help-files.html' title='Combining PowerBuilder Help Files'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-1642231492014122229</id><published>2008-05-22T03:01:00.000-05:00</published><updated>2008-05-22T03:02:21.440-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows server'/><title type='text'>Using Windows Server 2008 as a SUPER workstation OS</title><content type='html'>&lt;h1 class="entryviewheading"&gt;Using Windows Server 2008 as a SUPER workstation OS&lt;/h1&gt; &lt;p&gt;Windows Server 2008 is the best OS to be released till date from Microsoft's stable. And the moment I got hold of the RTM build I could not resist installing it on my workstation. Due to the nature of my work I always prefer running a Server OS on my main workstation... I have been running Windows 2003 disguised as XP (with all the themes and stuff) all these days.&lt;/p&gt; &lt;p&gt;So here is my tale of how I went about setting up Windows Server 2008 to look and fell like its desktop counterpart Windows Vista.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;1. Enable Hardware Virtualization&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;My workstation is a x64 machine with hardware virtualization capabilities. This means I can run Hyper-V on my machine. Even if your machine's hardware supports virtualization it is most likely not going to be enabled by default. You have to enable it via your BIOS setup.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;2. Install the latest Graphics and Audio drivers&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Being a server OS Windows 2008 carries with it basic graphics and audio drivers. To utilize the full strength of your hardware ensure you install the latest drivers for both graphics and audio hardware. Only with the proper graphics drivers will you be able to enable the "Aero" experience on Windows 2008.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;3. Desktop Experience Feature&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;The Desktop Experience Feature enables a bunch of stuff that is by default present on a desktop OS. Most importantly it includes Themes, Windows Media player and the Aero related features. You will have to enable it form the Server Manager. The "&lt;strong&gt;Turn Windows features on or off&lt;/strong&gt;" / "&lt;strong&gt;Add remove windows components&lt;/strong&gt;" has all been rolled into the Server Manager now.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Server Manager &gt; Features &gt; Desktop Experience&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Installing the Desktop Experience feature does not enable them. You have to manually set them up.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;4. Themes&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;To enable Themes you will basically have to enable the Themes Service. Again being a server OS it is not enabled by default.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Services.MSC &gt; Themes&lt;/strong&gt; &lt;/p&gt; &lt;p&gt;Set the start up type to Automatic &lt;/p&gt; &lt;p&gt;Enabling the Aero Theme. &lt;/p&gt; &lt;p&gt;For this go to &lt;strong&gt;Control Panel &gt; Personalization &gt;Theme&lt;/strong&gt; and select &lt;strong&gt;Windows Aero&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;5. Search&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Search is also disabled by default on Windows 2008. Searching is important for me as I use it a lot to find my emails. To enable search you will have to add the File Services Role via Server Manager.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Server Manager &gt; Roles &gt; File Services &gt; Windows Search&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Outlook relies on this search service. &lt;/p&gt; &lt;p&gt;&lt;strong&gt;6. Disable Shutdown Event Tracker&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Since I am using it as a workstation I do not want to keep a track of all the Shutdowns. The Shutdown Event Tracker is the pop up that you get asking you for a shutdown reason. To disable it &lt;/p&gt; &lt;p&gt;Open &lt;strong&gt;mmc.msc&lt;/strong&gt; &lt;/p&gt; &lt;p&gt;Add the &lt;strong&gt;Group Policy&lt;/strong&gt; snap-in&lt;/p&gt; &lt;p&gt;Under &lt;strong&gt;Administrative Templates&lt;/strong&gt; expand &lt;strong&gt;System&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Set &lt;strong&gt;Display Shutdown Event Tracer&lt;/strong&gt; to Disabled&lt;/p&gt; &lt;p&gt;&lt;strong&gt;7. Audio&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;For audio you need to enable the Windows Audio service. You do this by setting the startup type to Automatic. &lt;/p&gt; &lt;p&gt;&lt;strong&gt;Services.msc &gt; Windows Audio&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Ensure you have proper drivers for your audio hardware... for me the default driver was not enabling the headphones ... it started working fine after I got the proper driver.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;8. SuperFetch&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;As a workstation, enabling SupertFetch will give you that additional bit of responsiveness. The SuperFetch services is disabled by default and when you try to enable it you will most likely get an error message "&lt;strong&gt;The operating system is not presently configured to run this application&lt;/strong&gt;" &lt;/p&gt; &lt;p&gt;You will have to make two registry changes to enable this service. I basically copied them over from my Vista machine.&lt;/p&gt; &lt;p&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters&lt;/p&gt; &lt;p&gt;EnablePrefetcher DWORD 3&lt;/p&gt; &lt;p&gt;EnableSuperfetch DWORD 3&lt;/p&gt; &lt;p&gt;&lt;strong&gt;9. Get a codec pack.&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;For media hungry buffs download a codec pack. This will ensure you can play all media files.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;10. Enable Hyper-V&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;With Hyper-V you can run virtual machines on your workstation. This is useful if you want to run your tests on older OS versions. Enabling  Hyper-V is easy &lt;/p&gt; &lt;p&gt;&lt;strong&gt;Server Manager &gt; Roles &gt; Hyper-V&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Remember you need a Hyper-V enabled Windows 2008 licence and also your hardware has to support virtualization.&lt;/p&gt; &lt;p&gt;Also If you are using an existing VHD it may ask you to re-Activate Windows as it detected hardware changes.&lt;/p&gt; &lt;p&gt;One good thing about Windows Server 2008 is that it no longer asks for the i386 folder like Windows 2003 while you enable features.&lt;/p&gt; &lt;p&gt;&lt;a class="" title="Using Windows Server 2008 as a SUPER workstation OS ... Cont'd" href="http://blogs.msdn.com/vijaysk/archive/2008/02/20/using-windows-server-2008-as-a-super-workstation-os-cont-d.aspx" mce_href="http://blogs.msdn.com/vijaysk/archive/2008/02/20/using-windows-server-2008-as-a-super-workstation-os-cont-d.aspx"&gt;Using Windows Server 2008 as a SUPER workstation OS ... Cont'd&lt;/a&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Here are a couple of things I missed in my previous post&lt;/p&gt; &lt;p&gt;&lt;strong&gt;11. Processor Scheduling&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;As pointed out in a comment on my previous post; On Windows Server 2008 background services are given preference over interactive programs. You can change this behavior by&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Control Panel &gt; System and Maintenance &gt; System &gt; Advanced System Settings &gt; Advanced &gt; Performance &gt; Settings &gt; Advanced &gt; Processor Scheduling&lt;/strong&gt; &lt;/p&gt; &lt;p&gt;Setting this to Programs will make foreground programs more responsive. &lt;/p&gt; &lt;p&gt;&lt;strong&gt;12. Visual Effects&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;One thing you will notice on Windows Server 2008 is that by default you will not see Preview Thumbnails in your Documents / Music / Video folders. This has to be enabled explicitly.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Control Panel &gt; System and Maintenance &gt; System &gt; Advanced System Settings &gt; Advanced &gt; Performance &gt; Settings &gt; Visual Effects&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Based on your preference you can tweak these settings.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;13. Power Options&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Do your bit for a Green World! The Balanced (default) power plan on Windows Server 2008  does not turn off hard disks by default. On Vista hard disks are turned off after 20 mins. You can change this by&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Control Panel &gt; Hardware and Sound &gt; Power Options &gt; Change plan settings&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;It does take a bit to kick start the hard disks when you resume work but that's a sacrifice worth making for a greener world :).&lt;/p&gt; &lt;p&gt;&lt;strong&gt;14. IE Enhanced Security&lt;/strong&gt; &lt;/p&gt; &lt;p&gt;IE Enhanced Security Configuration has been moved from Add Remove Windows Components (on Windows 2003) to the Server Manager on Windows Server 2008. &lt;/p&gt; &lt;p&gt;&lt;strong&gt;Server Manager &gt; Security Information &gt; Configure IE ESC&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;You now have a choice to disable it only for Administrators. &lt;/p&gt; &lt;p&gt;And to end with a couple of clarifications&lt;/p&gt; &lt;p&gt;&lt;strong&gt;*&lt;/strong&gt; Why am I recommending Windows Server 2008 over Windows Vista ?&lt;/p&gt; &lt;p&gt;I am not! &lt;/p&gt; &lt;p&gt;&lt;strong&gt;*&lt;/strong&gt; How to get Sidebar / Media center on Windows Server 2008?&lt;/p&gt; &lt;p&gt;My honest opinion would be to look for alternatives.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;* &lt;/strong&gt;Will hardware problems go away moving to Windows Server 2008?&lt;/p&gt; &lt;p&gt;Not likely. One of the biggest complaints against Vista was hardware issues. Without proper  drivers from your hardware vendors your ride on Windows Server 2008 is again going to be bumpy. For me all Vista compatible drivers worked fine with Server 2008 and I believe they should work for you as well.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;* &lt;/strong&gt;Will all software work on Windows Server 2008?&lt;/p&gt; &lt;p&gt;Most will but some setups detect Windows Server 2008 as a server OS and may not install. The compatibility mode does not have a Vista option only XP / Windows 2003 and other legacy OS.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-1642231492014122229?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://blogs.msdn.com/vijaysk/archive/2008/02/11/using-windows-server-2008-as-a-super-desktop-os.aspx' title='Using Windows Server 2008 as a SUPER workstation OS'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/1642231492014122229/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=1642231492014122229&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/1642231492014122229'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/1642231492014122229'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/05/using-windows-server-2008-as-super.html' title='Using Windows Server 2008 as a SUPER workstation OS'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-2502160201764871128</id><published>2008-05-11T12:03:00.002-05:00</published><updated>2008-05-11T12:04:56.456-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>C# class initialization order</title><content type='html'>1) Derived static constructor&lt;br /&gt;2) Derived Instance members constructor&lt;br /&gt;3) Base static constructor&lt;br /&gt;4) Base Instance consctructor (members too)&lt;br /&gt;5) Derived Instance constructor&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-2502160201764871128?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/2502160201764871128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=2502160201764871128&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/2502160201764871128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/2502160201764871128'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/05/c-class-initialization-order.html' title='C# class initialization order'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-5333635314399636411</id><published>2008-04-12T08:24:00.000-05:00</published><updated>2008-04-12T08:26:32.179-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='excel'/><category scheme='http://www.blogger.com/atom/ns#' term='office'/><category scheme='http://www.blogger.com/atom/ns#' term='data conversion'/><category scheme='http://www.blogger.com/atom/ns#' term='utilities'/><title type='text'>Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats</title><content type='html'>&lt;span&gt;Users of the Microsoft Office XP and 2003 programs Word, Excel, or  PowerPoint—&lt;b&gt;please install all High-Priority updates from &lt;/b&gt;&lt;a href="http://update.microsoft.com/"&gt;Microsoft Update&lt;/a&gt; &lt;b&gt;before downloading  the Compatibility Pack&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;By installing the Compatibility Pack in  addition to Microsoft Office 2000, Office XP, or Office 2003, you will be able  to open, edit, and save files using the &lt;a href="http://support.microsoft.com/kb/924074"&gt;file formats new to Word, Excel,  and PowerPoint 2007&lt;/a&gt;. The Compatibility Pack can also be used in conjunction  with the Microsoft Office Word Viewer 2003, Excel Viewer 2003, and PowerPoint  Viewer 2003 to view files saved in these new formats. For more information about  the Compatibility Pack, see &lt;a href="http://support.microsoft.com/kb/924074"&gt;Knowledge Base article  924074&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note:&lt;/b&gt; If you use Microsoft Word 2000 or Microsoft Word  2002 to read or write documents containing complex scripts, please see &lt;a href="http://support.microsoft.com/kb/925451"&gt;http://support.microsoft.com/kb/925451&lt;/a&gt;  for information to enable Word 2007 documents to be displayed correctly in your  version of Word.&lt;br /&gt;&lt;/span&gt;&lt;table dir="ltr" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;&lt;tbody&gt;&lt;tr valign="top"&gt;&lt;td dir="ltr" width="100%"&gt;&lt;br /&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-5333635314399636411?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.microsoft.com/downloads/details.aspx?familyid=941B3470-3AE9-4AEE-8F43-C6BB74CD1466&amp;displaylang=en' title='Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/5333635314399636411/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=5333635314399636411&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/5333635314399636411'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/5333635314399636411'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/04/microsoft-office-compatibility-pack-for.html' title='Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 File Formats'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-7552996455008421526</id><published>2008-04-11T13:40:00.005-05:00</published><updated>2008-04-11T13:48:55.639-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='performance'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='iis'/><category scheme='http://www.blogger.com/atom/ns#' term='asp'/><title type='text'>All you want to know about ViewState and why it can be so bad</title><content type='html'>&lt;h2 style="font-weight: normal;" class="entry-title"&gt;&lt;a class="entry-title-link" target="_blank" href="http://www.pheedo.com/click.phdo?i=820f496b968a039cb0f33c2699dc1cf2"&gt;Keep ViewState out of Page for Performance Enhancement Redux&lt;/a&gt;&lt;/h2&gt; &lt;h2 style="font-weight: normal;"&gt;&lt;a href="http://blogs.msdn.com/tess/archive/2006/11/24/asp-net-case-study-bad-perf-high-memory-usage-and-high-cpu-in-gc-death-by-viewstate.aspx"&gt;Death By ViewState - Bad perf, high memory usage and high CPU in GC - Death By ViewState&lt;/a&gt;&lt;/h2&gt;&lt;h2 style="font-weight: normal;"&gt;&lt;a href="http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/Truly-Understanding-Viewstate.aspx"&gt;                 TRULY Understanding ViewState&lt;/a&gt;&lt;/h2&gt;&lt;span style="font-size:180%;"&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ms972976.aspx"&gt;Understanding ASP.NET View State&lt;/a&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-7552996455008421526?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://petesbloggerama.blogspot.com/2008/01/like-bagel-with-that-antivirus.html' title='All you want to know about ViewState and why it can be so bad'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/7552996455008421526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=7552996455008421526&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/7552996455008421526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/7552996455008421526'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/04/all-you-want-to-know-about-viewstate.html' title='All you want to know about ViewState and why it can be so bad'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-153198601051040051</id><published>2008-04-06T11:04:00.004-05:00</published><updated>2008-04-14T21:36:59.347-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows XP'/><category scheme='http://www.blogger.com/atom/ns#' term='registry'/><title type='text'>Resize Thumbnails in Windows Explorer</title><content type='html'>&lt;img style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center" alt="" src="http://www.codeproject.com/KB/system/WinThumbnailResizer/WinThumbResizer2.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;Create a DWORD key named ThumbnailSize under MyComputer\\HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer&lt;br /&gt;&lt;br /&gt;Give it any value such as 128, 256, etc.&lt;br /&gt;&lt;br /&gt;Article : If any of you out there like to use the thumbnail view, especially for browsing through photos and images, it can become a bit of a drain on your system. It is possible to lower the thumbnail size and quality by editing the following registry keys.&lt;br /&gt;&lt;br /&gt;Open the &lt;a href="http://v2.tlab404.com/articles/registry.asp"&gt;registry&lt;/a&gt; and navigate to :&lt;br /&gt;&lt;br /&gt;HKEY_CURRENT_USER\ Software\ Microsoft \ Windows\ CurrentVersion\ Explorer&lt;br /&gt;&lt;br /&gt;Create a new DWORD value called ThumbnailSize, and set the value between 32 and 256.&lt;br /&gt;&lt;br /&gt;And/or create another DWORD value called ThumbnailQuality, and set the value between 50 and 100.&lt;br /&gt;Key Details :&lt;br /&gt;&lt;br /&gt;USER Key:&lt;br /&gt;[HKEY_CURRENT_USER\ Software\ Microsoft \ Windows\ CurrentVersion\ Explorer]&lt;br /&gt;Value Name: ThumbnailSize&lt;br /&gt;Data Type: REG_DWORD (DWORD Value)&lt;br /&gt;Data Value: 32 - 256&lt;br /&gt;&lt;br /&gt;USER Key:&lt;br /&gt;[HKEY_CURRENT_USER\ Software\ Microsoft \ Windows\ CurrentVersion\ Explorer]&lt;br /&gt;Value Name: ThumbnailQuality&lt;br /&gt;Data Type: REG_DWORD (DWORD Value)&lt;br /&gt;Data Value: 50 - 100&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-153198601051040051?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.codeproject.com/KB/system/WinThumbnailResizer.aspx' title='Resize Thumbnails in Windows Explorer'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/153198601051040051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=153198601051040051&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/153198601051040051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/153198601051040051'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/04/resize-thumbnails-in-windows-explorer.html' title='Resize Thumbnails in Windows Explorer'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-7609846738290102251</id><published>2008-03-17T22:36:00.001-05:00</published><updated>2008-03-17T22:38:03.602-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='text'/><category scheme='http://www.blogger.com/atom/ns#' term='PSP'/><category scheme='http://www.blogger.com/atom/ns#' term='data conversion'/><title type='text'>Create Formatted Text Documents for PSP</title><content type='html'>Create Formatted Text Documents for PSP&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;I did some research and thought I would post my results for anyone with a hankering to put formatted text and images right onto a PSP. This will only work with PCs since it focuses on using Paperless Printer to make your JPGs. I used Open office (www.openoffice.org) to create the test documents. You can use any word processor or page layout app you want.&lt;br /&gt;&lt;br /&gt;Here is Paperless Printer. Free for non commercial work.&lt;br /&gt;http://www.rarefind.com/paperlessprinter/downloads/paperlessprinter_3.0_setup.exe&lt;br /&gt;&lt;br /&gt;To setup a document to be the right dimensions to print to Paperless Pritner is pretty easy and is great for getting pur text documents into the PSP as jpegs.&lt;br /&gt;&lt;br /&gt;• Paperless Printer uses and odd pixel to inch conversion(98.159...pixels per inch). So these settings won't work with Acrobat (72ppi) or other software.&lt;br /&gt;• Page size should be set to 4.89x2.81.&lt;br /&gt;• Set all margins to 0. This allows tables or rules to reach the edges of the screen if you want them to.&lt;br /&gt;• Text and other elements just change the indent on both sides to move them in 1/8th of an inch. This gives a little breathing room so the text doesn't touch the edge of the screen.&lt;br /&gt;• The two fonts that work best on computer screens are Georgia and Verdana. They were originally designed for screen display and are quite readable on the PSP as well, you can, of course, use any font you like. Font size should be 10-14 depending on how good your eyes are. I found 12 to be more than enough and verdana and georgia are readable at 10 points.&lt;br /&gt;• You will need to change the margins on your headers and footers (automatic in Word). Set their margin to 0.01 so it seperates a little from the top.&lt;br /&gt;&lt;br /&gt;Once you have this format you can use any images, text and formatting and it will all go over to the PSP. The Paperless Printer has a lousy compressor so leave compression 90% or higher.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-7609846738290102251?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.psp411.com/show/guide/8/0/Create_Formatted_Text_Documents_for_PSP.html' title='Create Formatted Text Documents for PSP'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/7609846738290102251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=7609846738290102251&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/7609846738290102251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/7609846738290102251'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/03/create-formatted-text-documents-for-psp.html' title='Create Formatted Text Documents for PSP'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-5627165616492751926</id><published>2008-02-28T15:14:00.001-06:00</published><updated>2008-02-28T15:23:48.933-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows XP'/><title type='text'>How to stop Windows Update nagging you to restart after an update</title><content type='html'>How to stop Windows Update nagging you to restart after an update&lt;br /&gt;&lt;br /&gt;After Windows Automatic Updates has downloaded updates to your computer, it may display a dialog that says: "Updating your computer is almost complete. You must restart your computer for the updates to take effect. Do you want to restart your computer now?" If you click "Restart Later", the dialog will appear again after 10 minutes, which is very annoying if you are busy and consider that your computer should not put its needs above your own.&lt;br /&gt;Solution&lt;br /&gt;&lt;br /&gt;Windows may need to be restarted after an update has occurred, in order to allow files that are in use to be replaced. If you would prefer to restart the computer at your convenience, and not be nagged to do so, try one of the following solutions:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Method 1&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   * Click Start, Run and enter the command &lt;span style="font-weight: bold;"&gt;net stop wuauserv&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This will stop the Windows Update service until the next restart of the computer, which will stop the reminders to restart your computer for this update.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Method 2&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you are running Windows XP Professional, the following steps will increase the period between restart reminders to the maximum possible.&lt;br /&gt;&lt;br /&gt;   * Click Start, Run and enter the command &lt;span style="font-weight: bold;"&gt;gpedit.msc&lt;/span&gt;&lt;br /&gt;   * Select Local Computer Policy, Computer Configuration, Administrative Templates, Windows Components, Windows Update&lt;br /&gt;   * Double-click Re-prompt for restart with scheduled installations&lt;br /&gt;   * Change the value to 1440&lt;br /&gt;   * Close the Group Policy Editor&lt;br /&gt;   * Click Start, Run and enter the command gpupdate /force&lt;br /&gt;&lt;br /&gt;This will stop the repeated reminders for this and all future Windows updates.&lt;br /&gt;&lt;p&gt;If you have Windows XP Home instead of Windows XP Pro, you will probably get the following message:&lt;/p&gt;&lt;blockquote&gt;  &lt;p&gt;Windows cannot find 'gpedit.msc'. Make sure you typed the name correctly, and then try again. To search for a file, click the Start button, and then click Search.&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;  &lt;p&gt;GPEDIT doesn't exist on Windows XP Home edition, since it's for Group Policy, a Windows XP Pro feature. However, you can set the key in the group policy area of your registry. Google for the links, or just download and double-click on the .reg file mentioned in this post: &lt;a href="http://computer-vet.com/weblog/2005/05/20/windows_automatic_reboots.html"&gt;http://computer-vet.com/weblog/2005/05/20/windows_automatic_reboots.html&lt;/a&gt;&lt;/p&gt;&lt;strong&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU&lt;/strong&gt;&lt;br /&gt;DWORD value &lt;span style="font-weight: bold;"&gt;"&lt;/span&gt;&lt;strong&gt;NoAutoRebootWithLoggedOnUsers&lt;/strong&gt;" set to 1.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-5627165616492751926?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.the-pc-guru.com/How_to_stop_Windows_Update_n.php' title='How to stop Windows Update nagging you to restart after an update'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/5627165616492751926/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=5627165616492751926&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/5627165616492751926'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/5627165616492751926'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/02/how-to-stop-windows-update-nagging-you.html' title='How to stop Windows Update nagging you to restart after an update'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-3419715441706740456</id><published>2008-02-04T10:49:00.000-06:00</published><updated>2008-02-04T10:50:20.871-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='excel'/><category scheme='http://www.blogger.com/atom/ns#' term='internet'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='iis'/><title type='text'>Using Microsoft Excel within your ASP.NET application</title><content type='html'>&lt;div class="title"&gt;     &lt;h2&gt;&lt;a id="viewpost_ascx_TitleUrl" title="Title of this entry." href="http://blog.crowe.co.nz/archive/2006/03/02/589.aspx"&gt;COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005.&lt;/a&gt; &lt;/h2&gt;  &lt;/div&gt;    &lt;div class="body"&gt;   &lt;p&gt;If you add a reference to Microsoft Excel and then try to use it within your ASP.NET application you may receive the following error.&lt;/p&gt; &lt;p&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;Server Error in '/excel' Application. &lt;/strong&gt;&lt;/span&gt;&lt;/p&gt; &lt;hr   width="100%" style="font-size:78%;color:#c0c0c0;"&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="color:#800000;"&gt;Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005. &lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;h3&gt;Example Application&lt;/h3&gt; &lt;p&gt;&lt;img src="http://blog.crowe.co.nz/images/excel_1.gif" alt="" src="http://blog.crowe.co.nz/images/excel_1.gif" border="0" height="686" width="672" /&gt;&lt;/p&gt; &lt;p&gt;The problem is that by default Microsoft Excel as a COM object can only activated by the following accounts:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;Administrator &lt;/li&gt;&lt;li&gt;System &lt;/li&gt;&lt;li&gt;Interactive &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;When you are running your ASP.Net account on Windows XP your web application is running as the ASPNET account.&lt;/p&gt; &lt;p&gt;The way to resolve this issue is to edit the DCOM configuration settings for the Microsoft Excel Application object.&lt;/p&gt; &lt;h3&gt;Configure DCOM&lt;/h3&gt; &lt;ul&gt;&lt;li&gt;Go to the Start-Run menu item. &lt;/li&gt;&lt;li&gt;Type in "DCOMCNFG" and hit enter. &lt;/li&gt;&lt;li&gt;This should load the "Component Services" MMC (you can also load from Administrative Tools - Component Services" &lt;/li&gt;&lt;li&gt;Expand "Component Services" &lt;/li&gt;&lt;li&gt;Expand "Computers" &lt;/li&gt;&lt;li&gt;Expand "My Computer" &lt;/li&gt;&lt;li&gt;Select the "DCOM Config" item &lt;/li&gt;&lt;li&gt;Select the "Microsoft Excel Application" item. &lt;/li&gt;&lt;li&gt;Right click and select Properties &lt;/li&gt;&lt;li&gt;Select the Security Tab and you should see the following:&lt;br /&gt;   &lt;br /&gt;    &lt;img src="http://blog.crowe.co.nz/images/excel_3.gif" alt="" src="http://blog.crowe.co.nz/images/excel_3.gif" border="0" height="455" width="404" /&gt;&lt;br /&gt;   &lt;br /&gt;      &lt;/li&gt;&lt;li&gt;Under "&lt;strong&gt;Launch and Activation Permissions&lt;/strong&gt;" select the "&lt;strong&gt;Customize&lt;/strong&gt;" option. &lt;/li&gt;&lt;li&gt;Click the "&lt;strong&gt;Edit&lt;/strong&gt;" button&lt;br /&gt;   &lt;br /&gt;    &lt;table summary="" border="0" cellpadding="1" cellspacing="1"&gt;         &lt;tbody&gt;             &lt;tr&gt;                 &lt;td&gt;                 &lt;p align="center"&gt;&lt;strong&gt;Windows XP&lt;/strong&gt;&lt;/p&gt;                 &lt;/td&gt;                 &lt;td&gt;                 &lt;p align="center"&gt;&lt;strong&gt;          &lt;/strong&gt;&lt;/p&gt;                 &lt;/td&gt;                 &lt;td&gt;                 &lt;p align="center"&gt;&lt;strong&gt;Windows 2003 Server&lt;/strong&gt;&lt;/p&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;&lt;img src="http://blog.crowe.co.nz/images/excel_4.gif" alt="" src="http://blog.crowe.co.nz/images/excel_4.gif" border="0" height="450" width="367" /&gt;&lt;/td&gt;                 &lt;td&gt; &lt;/td&gt;                 &lt;td&gt;&lt;img src="http://blog.crowe.co.nz/images/blog_crowe_co_nz/launchdefault2003permissions.png" alt="" src="http://blog.crowe.co.nz/images/blog_crowe_co_nz/launchdefault2003permissions.png" height="445" width="367" /&gt;&lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;     &lt;/table&gt;    &lt;br /&gt;     &lt;br /&gt;      &lt;/li&gt;&lt;li&gt;Click the "Add" button to add a new account to the list. &lt;/li&gt;&lt;li&gt;On the dialog that is displayed click the Locations button&lt;br /&gt;   &lt;br /&gt;    (this is because by default your domain will be selected and we need a local account)&lt;br /&gt;   &lt;br /&gt;In this dialog scroll the list to the top (sometimes the first item is not visible) but scroll to the top and select the first item which is your computer name. In the list below "CCROWE" is the name of my computer.&lt;br /&gt;   &lt;br /&gt;    &lt;img src="http://blog.crowe.co.nz/images/excel_5.gif" alt="" src="http://blog.crowe.co.nz/images/excel_5.gif" border="0" height="292" width="505" /&gt;&lt;br /&gt;   &lt;br /&gt;      &lt;/li&gt;&lt;li&gt;Click the OK button &lt;/li&gt;&lt;li&gt;On the dialog that is displayed enter "&lt;strong&gt;ASPNET&lt;/strong&gt;" as the account name (make sure location is set to the name of the computer that IIS is on) on &lt;strong&gt;Windows XP&lt;/strong&gt; or if you are running on &lt;strong&gt;Windows 2003 Server&lt;/strong&gt; you must enter the account that the &lt;strong&gt;Application Pool&lt;/strong&gt; is running as, by default "&lt;strong&gt;Network Service&lt;/strong&gt;"&lt;br /&gt;   &lt;br /&gt;    &lt;table summary="" border="0" cellpadding="1" cellspacing="1"&gt;         &lt;tbody&gt;             &lt;tr&gt;                 &lt;td&gt;                 &lt;p align="center"&gt;&lt;strong&gt;Windows XP&lt;/strong&gt;&lt;/p&gt;                 &lt;/td&gt;                 &lt;td&gt;               &lt;/td&gt;                 &lt;td&gt;                 &lt;p align="center"&gt;&lt;strong&gt;Windows 2003 Server&lt;/strong&gt;&lt;/p&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td valign="top"&gt;                 &lt;p&gt;&lt;img src="http://blog.crowe.co.nz/images/Excel_6.gif" alt="" src="http://blog.crowe.co.nz/images/Excel_6.gif" border="0" height="254" width="464" /&gt;&lt;/p&gt;                 &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: A quicker way on Windows XP is to just enter the computer name and the account&lt;br /&gt;                so in my case that would be:&lt;br /&gt;               &lt;br /&gt;                &lt;strong&gt;          ccrowe\ASPNET&lt;/strong&gt; &lt;/p&gt;                 &lt;/td&gt;                 &lt;td&gt; &lt;/td&gt;                 &lt;td&gt;                 &lt;p&gt;&lt;img src="http://blog.crowe.co.nz/images/blog_crowe_co_nz/lauchDefaultAppPool.png" alt="" src="http://blog.crowe.co.nz/images/blog_crowe_co_nz/lauchDefaultAppPool.png" height="435" width="461" /&gt;&lt;/p&gt;                 &lt;p&gt;&lt;img src="http://blog.crowe.co.nz/images/blog_crowe_co_nz/launchnetwrokservice1.png" alt="" src="http://blog.crowe.co.nz/images/blog_crowe_co_nz/launchnetwrokservice1.png" height="246" width="463" /&gt;&lt;/p&gt;                 &lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;     &lt;/table&gt;    &lt;br /&gt;    &lt;/li&gt;&lt;li&gt;Click the OK button&lt;br /&gt;    &lt;/li&gt;&lt;li&gt;Now make sure you select the following options for the "ASP.NET Machine Account" or the account that is the application pool identity ( by default Network Service)&lt;br /&gt;          &lt;ul&gt;&lt;li&gt;&lt;strong&gt;Local Launch         : Allow&lt;/strong&gt; &lt;/li&gt;&lt;li&gt;Remote Launch        : [blank] &lt;/li&gt;&lt;li&gt;&lt;strong&gt;Local Activation     : Allow&lt;/strong&gt; &lt;/li&gt;&lt;li&gt;Remote Activation    : [blank] &lt;/li&gt;&lt;/ul&gt;     &lt;p&gt;These settings can be seen below:&lt;/p&gt;     &lt;/li&gt;&lt;li&gt;     &lt;p&gt; &lt;/p&gt;     &lt;table summary="" border="0" cellpadding="1" cellspacing="1"&gt;         &lt;tbody&gt;             &lt;tr&gt;                 &lt;td&gt;                 &lt;p align="center"&gt;&lt;strong&gt;Windows XP&lt;/strong&gt;&lt;/p&gt;                 &lt;/td&gt;                 &lt;td&gt;                 &lt;p align="center"&gt;&lt;strong&gt;          &lt;/strong&gt;&lt;/p&gt;                 &lt;/td&gt;                 &lt;td&gt;                 &lt;p align="center"&gt;&lt;strong&gt;Windows 2003 Server&lt;/strong&gt;&lt;/p&gt;                 &lt;/td&gt;             &lt;/tr&gt;             &lt;tr&gt;                 &lt;td&gt;&lt;img src="http://blog.crowe.co.nz/images/excel_7.gif" alt="" src="http://blog.crowe.co.nz/images/excel_7.gif" /&gt;&lt;/td&gt;                 &lt;td&gt; &lt;/td&gt;                 &lt;td&gt;&lt;img fix="fixed" src="http://blog.crowe.co.nz/images/blog_crowe_co_nz/launchnetwrokservice%283%29.png" alt="" src="http://blog.crowe.co.nz/images/blog_crowe_co_nz/launchnetwrokservice%283%29.png" height="443" width="367" /&gt;&lt;/td&gt;             &lt;/tr&gt;         &lt;/tbody&gt;     &lt;/table&gt;     &lt;/li&gt;&lt;li&gt;     &lt;p&gt;Click the OK button and test your web application again and it should work fine.&lt;/p&gt;     &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;&lt;strong&gt;&lt;span style="color:#ff0000;"&gt;Note: Remember if you are running on Windows 2003 Server you must use the application pool identity as the account and not the ASPNET account.&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt; &lt;/p&gt;  &lt;/div&gt;    &lt;div class="info"&gt;   posted on   Thursday, March 02, 2006 4:18 AM |    Filed Under [     &lt;a id="viewpost_ascx_Categories_CatList_ctl01_Link" title="" href="http://blog.crowe.co.nz/category/10.aspx"&gt;ASP.Net&lt;/a&gt;     &lt;a id="viewpost_ascx_Categories_CatList_ctl02_Link" title="" href="http://blog.crowe.co.nz/category/11.aspx"&gt;c#&lt;/a&gt;     &lt;a id="viewpost_ascx_Categories_CatList_ctl03_Link" title="" href="http://blog.crowe.co.nz/category/1.aspx"&gt;IIS&lt;/a&gt;     ]     &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-3419715441706740456?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://blog.crowe.co.nz/archive/2006/03/02/589.aspx' title='Using Microsoft Excel within your ASP.NET application'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/3419715441706740456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=3419715441706740456&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/3419715441706740456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/3419715441706740456'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/02/using-microsoft-excel-within-your.html' title='Using Microsoft Excel within your ASP.NET application'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-4545858549730568046</id><published>2008-02-01T11:48:00.000-06:00</published><updated>2008-02-01T11:49:02.612-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Capitalize Initial in C#</title><content type='html'>private static string CapitalizeInitial(string strValue)&lt;br /&gt;    {&lt;br /&gt;        if (strValue.Length == 0)&lt;br /&gt;            return strValue;&lt;br /&gt;&lt;br /&gt;        return String.Concat( strValue.Substring( 0, 1 ).ToUpper(),&lt;br /&gt;                                strValue.Substring( 1 ) );&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-4545858549730568046?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/4545858549730568046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=4545858549730568046&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/4545858549730568046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/4545858549730568046'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/02/capitalize-initial-in-c.html' title='Capitalize Initial in C#'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-6132686913255553258</id><published>2008-02-01T11:46:00.000-06:00</published><updated>2008-02-01T11:48:09.273-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dates'/><category scheme='http://www.blogger.com/atom/ns#' term='excel'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Converting Excel dates (numeric) to regular dates</title><content type='html'>When importing dates from Excel, it is common to obtain a number instead of a date. That is the number of days after 1/1/1900.&lt;br /&gt;&lt;br /&gt;    private static string ConvertExcelDate(string strDate)&lt;br /&gt;    {&lt;br /&gt;        int iDate = 0;&lt;br /&gt;        if (! int.TryParse(strDate, out iDate))&lt;br /&gt;            return "";&lt;br /&gt;        DateTime dtDate = new DateTime(1900, 1, 1);&lt;br /&gt;        dtDate = dtDate.AddDays(iDate - 2);&lt;br /&gt;        return dtDate.ToShortDateString();&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-6132686913255553258?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/6132686913255553258/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=6132686913255553258&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/6132686913255553258'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/6132686913255553258'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/02/converting-excel-dates-numeric-to.html' title='Converting Excel dates (numeric) to regular dates'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-2930891997193676328</id><published>2008-02-01T10:12:00.000-06:00</published><updated>2008-02-01T10:13:27.654-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='design patterns'/><title type='text'>101 Design Patterns &amp; Tips for Developers</title><content type='html'>&lt;h2 class="title" style="padding-left: 30px; font-size: 44px;"&gt;&lt;a href="http://sourcemaking.com/design-patterns-and-tips"&gt;101 Design Patterns &amp;amp; Tips for Developers&lt;/a&gt;&lt;/h2&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-2930891997193676328?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://sourcemaking.com/design-patterns-and-tips' title='101 Design Patterns &amp; Tips for Developers'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/2930891997193676328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=2930891997193676328&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/2930891997193676328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/2930891997193676328'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/02/101-design-patterns-tips-for-developers.html' title='101 Design Patterns &amp; Tips for Developers'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-207400468587785581</id><published>2008-01-25T15:26:00.000-06:00</published><updated>2008-01-25T15:32:04.185-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><category scheme='http://www.blogger.com/atom/ns#' term='iis'/><category scheme='http://www.blogger.com/atom/ns#' term='asp'/><title type='text'>The file web.sitemap required by XmlSiteMapProvider does not exist</title><content type='html'>&lt;h3 class="post-title entry-title"&gt; &lt;a href="http://metahat.blogspot.com/2007/10/file-websitemap-required-by.html"&gt;The file web.sitemap required by XmlSiteMapProvider does not exist&lt;/a&gt; &lt;/h3&gt;   &lt;p&gt;I used a custom XMLSiteMapProvider where in i have defined a web.sitemap file with urls.&lt;br /&gt;The application worked fine in the test environment and for administrators but errored out for other users.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The actual error was that the normal anonymous user didn't have enough permission to access the web.sitemap file - in fact it needed permission for the whole directory.&lt;/p&gt;It seems IIS still has some issues with directory/file permissions and the account used for anonymous access (e.g.: IUSR_MACHINENAME).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-207400468587785581?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/207400468587785581/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=207400468587785581&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/207400468587785581'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/207400468587785581'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/01/file-websitemap-required-by.html' title='The file web.sitemap required by XmlSiteMapProvider does not exist'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-16552672958884264</id><published>2008-01-14T12:35:00.000-06:00</published><updated>2008-01-14T12:37:15.294-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='telnet'/><category scheme='http://www.blogger.com/atom/ns#' term='tcp'/><category scheme='http://www.blogger.com/atom/ns#' term='internet'/><category scheme='http://www.blogger.com/atom/ns#' term='mail'/><title type='text'>How to email using TELNET</title><content type='html'>TELNET mail.plano1.tx.home.com 25&lt;br /&gt;HELO test (127.0.0.2)&lt;br /&gt;MAIL FROM:billgates@richguy.com&lt;br /&gt;RCPT TO:fulano@sicrano.com&lt;br /&gt;DATA&lt;br /&gt;bla-bla-bla&lt;br /&gt;&lt;br /&gt;.                                      (&lt;-  enter-dot-enter to finish)&lt;br /&gt;&lt;br /&gt;QUIT&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-16552672958884264?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/16552672958884264/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=16552672958884264&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/16552672958884264'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/16552672958884264'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/01/how-to-email-using-telnet.html' title='How to email using TELNET'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-5518249987419212278</id><published>2008-01-13T14:45:00.000-06:00</published><updated>2008-01-13T14:46:39.177-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='skype'/><category scheme='http://www.blogger.com/atom/ns#' term='windows XP'/><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='iis'/><title type='text'>Fixing Error when IIS doesn't start</title><content type='html'>&lt;h2&gt;&lt;a id="viewpost_ascx_TitleUrl" title="Title of this entry." class="singleposttitle" href="http://geekswithblogs.net/lorint/archive/2005/12/12/62910.aspx"&gt;A convenient way to deal with "Unexpected Error 0x8ffe2740"&lt;/a&gt;&lt;/h2&gt;     &lt;p&gt;Ever had the annoying problem of IIS not wanting to start, coughing up the message "Unexpected Error 0x8ffe2740 Occurred."?  The reason is that some other application has grabbed port 80.  The most common applications doing this are Skype or Trillion.  You can try just ending task on them and see if IIS will then start.  If you're not running either of those then what could it be?  Microsoft's &lt;a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;816944"&gt;KB article about the subject&lt;/a&gt; describes using the third-party utilities TCPView or FPort.  But I think an easier way to find the issue is to simply drop out to a command prompt and run:&lt;/p&gt; &lt;pre&gt;netstat -aon&lt;/pre&gt;  &lt;p&gt;Scroll up to the top part with TCP listings and you'll see something like this:&lt;/p&gt; &lt;p&gt;&lt;img src="http://couponmeister.com/blog/netstat-aon.gif" /&gt;&lt;/p&gt; &lt;p&gt;Then under "Local Address" look for 0.0.0.0:80.  This is your entry, and a the far right is the PID you're after.  With that number you can then run Task Manager, select the Process tab, and add the PID column in the display from View / Select Columns:&lt;/p&gt; &lt;p&gt;&lt;img src="http://couponmeister.com/blog/taskman_pid.gif" /&gt;&lt;/p&gt; &lt;p&gt;When you've found the process with the same PID, end task on it.  The universe should then return to a state of perfect harmony.  (Or at least your IIS will be able to start at that point!)&lt;/p&gt; &lt;p&gt;Another more geeky option to kill the offending app is to compile and run this line of .NET code:&lt;/p&gt; &lt;pre&gt;System.Diagnostics.Process.GetProcessById( &lt;strong&gt;PID#&lt;/strong&gt; ).Kill()&lt;/pre&gt;  &lt;p&gt;(Of course putting in the proper PID where indicated there.)&lt;/p&gt; With everything that the Process class does, you could actually write your own highly effective Task Manager application in .NET if you really wanted to!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-5518249987419212278?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://geekswithblogs.net/lorint/archive/2005/12/12/62910.aspx' title='Fixing Error when IIS doesn&apos;t start'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/5518249987419212278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=5518249987419212278&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/5518249987419212278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/5518249987419212278'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/01/fixing-error-when-iis-doesnt-start.html' title='Fixing Error when IIS doesn&apos;t start'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-891715472617439533</id><published>2008-01-13T09:34:00.000-06:00</published><updated>2008-01-13T09:36:14.597-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='disk'/><category scheme='http://www.blogger.com/atom/ns#' term='utilities'/><category scheme='http://www.blogger.com/atom/ns#' term='data recovery'/><category scheme='http://www.blogger.com/atom/ns#' term='spinrite'/><title type='text'>Utilities to replace SpinRite</title><content type='html'>The UBCD (&lt;a href="http://www.ultimatebootcd.com/" target="_blank"&gt;http://www.ultimatebootcd.com/&lt;/a&gt;) has several (free) utilities for scanning disks for physical failures.&lt;br /&gt;&lt;dl class="postSummary"&gt;&lt;dt&gt;&lt;br /&gt;&lt;/dt&gt;&lt;dt&gt;For data recovery tools: Undelete Plus (&lt;a href="http://www.undelete-plus.com/" target="_blank"&gt;http://www.undelete-plus.com/&lt;/a&gt;) and TestDisk (&lt;a href="http://www.cgsecurity.org/wiki/TestDisk" target="_blank"&gt;http://www.cgsecurity.org/wiki/TestDisk&lt;/a&gt;).&lt;/dt&gt;&lt;/dl&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-891715472617439533?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/891715472617439533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=891715472617439533&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/891715472617439533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/891715472617439533'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2008/01/utilities-to-replace-spinrite.html' title='Utilities to replace SpinRite'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-3859901492285754928</id><published>2007-12-24T08:36:00.000-06:00</published><updated>2007-12-24T09:40:30.336-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='MSMQ'/><category scheme='http://www.blogger.com/atom/ns#' term='web service'/><category scheme='http://www.blogger.com/atom/ns#' term='messaging'/><title type='text'>Asynchronous Web Services with MSMQ</title><content type='html'>Learn how to overcome a common scalability limitation of Web Services.&lt;br /&gt;Based on an article by Josh Lane&lt;br /&gt;&lt;br /&gt;Many of the first Web Services you create are likely to be synchronous, where processing for each service invocation is handled at the time of the invocation. However, Web Services of this sort can have scalability limitations. You can overcome these issues by using Microsoft Message Queue (MSMQ) with Web Services.&lt;br /&gt;&lt;br /&gt;Imagine you've decided to implement a help-desk-request logging system for a large IT department as a Web Service. This web service defines a single public SubmitRequest() method. The user request is processed immediately, regardless of current server load or database availability. This can limit scalability and robustness.&lt;br /&gt;&lt;br /&gt;&lt;table style="border: 1px solid rgb(102, 102, 102); color: rgb(51, 51, 51);" border="1" cellpadding="8" cellspacing="0" width="600"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="tabletext" bg="" width="600"&gt;&lt;pre class="codesnippet"&gt;&lt;webmethod(transactionoption&gt;Public Function SubmitRequest(ByVal request As HelpDeskRequest)&lt;br /&gt;Try&lt;br /&gt; Dim oldWriter as New OldSystemWriter&lt;br /&gt; oldWriter.SubmitRequest(request)&lt;br /&gt; dim newWriter as New NewSystemWriter&lt;br /&gt; newWriter.SubmitRequest(request)&lt;br /&gt; ContextUtil.SetComplete()&lt;br /&gt;Catch ex As Exception&lt;br /&gt; EventLog.WriterEntry("HelpDeskRequestProcessor", _&lt;br /&gt;   ex.Message,EventLogEntryType.Error )&lt;br /&gt; ContextUtil.SetAbort()&lt;br /&gt;End Try&lt;br /&gt;&lt;/webmethod(transactionoption&gt;&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;  &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;You can solve scalability problems by changing the web service from a &lt;span style="font-style: italic;"&gt;synchronous &lt;/span&gt;request model to an &lt;span style="font-style: italic;"&gt;asynchronous&lt;/span&gt; request model, introducing an intermediate component into the request-logging architecture that can take requests rapidly and guarantee their &lt;span style="font-style: italic;"&gt;eventual&lt;/span&gt; delivery.&lt;br /&gt;&lt;br /&gt;Such an asynchronous system can be built using MSMQ, a middleware subsystem that comes pre-installed on all Windows 2000 and upwards. It provides a means of storing messages of arbitrary content for forwarding or retrieval in operating-system-level structures called queues. MSMQ queues are Distributed Transaction Coordinator (DTC)-aware resource managers, meaning that send and receive operations against a queue can operate within a COM+ transaction. You can access the full complement of MSMQ services from the System.Messaging API in .NET.&lt;br /&gt;&lt;br /&gt;First, you need to build a component that's triggered when the request message queue on the server receives a help request. This component removes the message from the queue and performs the processing.&lt;br /&gt;&lt;br /&gt;&lt;table style="border: 1px solid rgb(102, 102, 102); color: rgb(51, 51, 51);" border="1" cellpadding="8" cellspacing="0" width="600"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="tabletext" bg="" width="600"&gt;&lt;pre class="codesnippet"&gt;The trigger calls this method each time a new message arrives in the&lt;br /&gt;target queue. Note that the queue path is passed in as a parameter. Also&lt;br /&gt;note that all work is performed inside a COM+ transaction, so the MSMQ&lt;br /&gt;receive operation and both SQL Server write operations are treated as&lt;br /&gt;a single atomic operation.&lt;br /&gt;&lt;hr /&gt;&lt;br /&gt;Public Sub ProcessMessage(ByVal path As String) _&lt;br /&gt;Implements IMsgHandler.ProcessMessage&lt;br /&gt;Dim mq As MessageQueue&lt;br /&gt;Dim m As Message&lt;br /&gt;Dim oldWriter as IRequestWriter&lt;br /&gt;Dim newWriter as IRequestWriter&lt;br /&gt;Try&lt;br /&gt; mq = New MessageQueue( path )&lt;br /&gt; m = mq.Receive()&lt;br /&gt; m.Formatter = New XmlMessageFormatter( _&lt;br /&gt;   New Type() { GetType( _&lt;br /&gt;   VSM_ShareTypes.HelpDeskRequest ) } )&lt;br /&gt; oldWriter = New OldSystemRequestWriter()&lt;webmethod(transactionoption&gt;&lt;br /&gt; oldWriter.WriteRequest( m.Body )&lt;br /&gt; newWriter&lt;/webmethod(transactionoption&gt; = New NewSystemRequestWriter()&lt;br /&gt; newWriter.WriteRequest( m.Body )&lt;br /&gt;&lt;webmethod(transactionoption&gt;  ContextUtil.SetComplete()&lt;br /&gt;Catch ex As Exception&lt;br /&gt; EventLog.WriterEntry("VSM_RequestHandler", _&lt;br /&gt;   ex.Message,EventLogEntryType.Error )&lt;br /&gt; ContextUtil.SetAbort()&lt;br /&gt;Finally&lt;br /&gt; mq.Dispose()&lt;br /&gt;End Try&lt;br /&gt;End Sub&lt;/webmethod(transactionoption&gt;&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;  &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Create an MSMQ Trigger Rule and register the COM+ components using &lt;a href="http://msdn2.microsoft.com/en-us/library/04za0hca%28VS.80%29.aspx"&gt;regsvcs.exe&lt;/a&gt;. Trigger rules allow your components to be invoked automatically as a result of messages arriving at the target queue. You can use MSMQ triggers to process queue messages instead of implementing a traditional queue listenener; be sure you understand the usage semantics of each option before choosing one.&lt;br /&gt;&lt;br /&gt;&lt;table style="border: 1px solid rgb(102, 102, 102); color: rgb(51, 51, 51);" border="1" cellpadding="8" cellspacing="0" width="600"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td class="tabletext" bg="" width="600"&gt;&lt;pre class="codesnippet"&gt;New Rule (set up in the Computer Management Console):&lt;br /&gt;Invoke COM component&lt;br /&gt;Component ProgID:  VSM_MessageHandler.HelpDeskRequestHandler&lt;br /&gt;Method Name: ProcessRequest&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Here the public web service is responsible only for receiving incoming requests and writing them to the target request queue. This simple, fast operation minimizes the work performed by the web server and allows you to maximize precious web server resources and minimize client response times. Note the use of a local transaction instead of a COM+ transaction (which would be overkill since it involves only a single resource manager - the queue).&lt;br /&gt;&lt;br /&gt;&lt;table style="border: 1px solid rgb(102, 102, 102); color: rgb(51, 51, 51);" border="1" cellpadding="8" cellspacing="0" width="600"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td class="tabletext" bg="" width="600"&gt;&lt;pre class="codesnippet"&gt;&lt;webmethod()&gt;&lt;br /&gt;Public Function SubmitOrder( ByVal order As HelpDeskRequest)&lt;br /&gt;Dim mqt As New MessageQueueTransaction()&lt;br /&gt;Dim mq As MessageQueue&lt;br /&gt;Try&lt;br /&gt; mq = New MessageQueue(m_QueuePath)&lt;br /&gt; mqt.Begin()&lt;br /&gt; mq.Send(order)&lt;br /&gt; mqt.Commit()&lt;br /&gt;Catch ex As Exception&lt;br /&gt; EventLog.WriteEntry( "VSM_RequestTaker", _&lt;br /&gt;  ex.Message, EventLogEntryType.Error )&lt;br /&gt; mqt.Abort()&lt;br /&gt;Finally&lt;br /&gt; mq.Dispose()&lt;br /&gt;End Try&lt;br /&gt;End Function&lt;/webmethod()&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;Also see &lt;a href="http://www.dthomas.co.uk/dtalm/downloads/MSMQ_Triggers.pdf"&gt;Using MSMQ message triggers (PDF file)&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-3859901492285754928?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/3859901492285754928/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=3859901492285754928&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/3859901492285754928'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/3859901492285754928'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/asynchronous-web-services-with-msmq.html' title='Asynchronous Web Services with MSMQ'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-715776200235098058</id><published>2007-12-24T01:05:00.000-06:00</published><updated>2007-12-24T09:22:09.194-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='charts'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><category scheme='http://www.blogger.com/atom/ns#' term='reports'/><title type='text'>Add Reports and Charts to Web Pages</title><content type='html'>&lt;p class="articleheadline"&gt;Add Reports and Charts to Web Pages&lt;/p&gt;               &lt;p class="articledeck"&gt; The ASP.NET 2.0 version of Visual Studio 2005's ReportViewer control and its Report Designer let Web page developers quickly embed, format, and export interactive reports and charts without running a SQL Server Report Server. &lt;/p&gt;             &lt;p&gt; March 2006   · by Roger  Jennings&lt;em&gt;&lt;/em&gt;&lt;/p&gt;                &lt;span id="intelliTXT"&gt;                   &lt;span class="DropCap"&gt;I&lt;/span&gt;t's convenient to be able to embed reports and charts in Windows forms, but you often need to make these same reports and charts available to those who must view them from the Internet or an intranet. &lt;p&gt;I described how to build Windows form (smart client) applications that use VS 2005's new ReportViewer controls to incorporate embedded reports and charts in a recent issue (see "&lt;a href="http://visualstudiomagazine.com/features/article.aspx?editorialsid=1300"&gt;Build Reports More Easily&lt;/a&gt;," &lt;em&gt;VSM&lt;/em&gt; November 2005). Now I'll show you how to accomplish the next step, which is using the Report Designer and ASP.NET 2.0 ReportViewer server control to create Web pages that contain reports and charts. I'll also describe how to repurpose the Report Definition Language Client (RDLC) XML files you created for smart client projects in the earlier article for use with the ASP.NET 2.0 ReportViewer server control. You'll also learn how to take advantage of XML InfoSet documents as the data source for smart client and Web-based projects, and overcome fatal "Failed to enable constraints" exceptions in Web reports. Along the way, I'll walk you through the important code-behind, design, and rendering differences between Windows and Web forms reports.&lt;/p&gt; &lt;p&gt;ReportViewer controls let you dispense with SQL Server Reporting Services (SSRS), which now requires a licensed edition of SQL Server 2005. The current version of SQL Server 2005 Express (SSX) doesn't support SSRS, but Microsoft promises a future SSX upgrade with a limited SSRS feature set. Unlike SSRS, which requires SQL Server 2005 or SSX, ReportViewer controls are database agnostic. You can use any database engine that has a native .NET, OLE DB, or ODBC driver that meets ADO.NET 2.0's requirements. You also can create a data source from an XML data document or instances of custom business objects.&lt;/p&gt; &lt;p&gt;This article's  &lt;a href="http://code.visualstudiomagazine.com/vs0603rj.zip" target="_blank"&gt;downloadable VB 2005 sample code&lt;/a&gt; includes Windows and Web form examples of tabular and crosstab reports, and charts that you generate from the AdventureWorks 2005 and Northwind sample databases. You must run the Transact-SQL scripts to install these two databases on your local instance of SQL Server 2005 or SSX to run the sample projects. If you use SSX, change the SQL Server connection string's localhost to localhost\SQLEXPRESS. The sample code installs by default in the current drive's \ReportViewer\ReportSmartClient and \ReportViewer\ReportWebSite folders. If you're running Visual Web Developer Express, install the Report Builder and ReportViewer (SQLServer2005_ReportAddIn.msi) add-ins before running the sample source code (see Additional Resources for links to the required files.)&lt;/p&gt; &lt;p&gt;Designing and embedding a tabular report in a Web form requires four basic steps: embed the ReportViewer server control; specify a report data source with the Table Adapter Configuration Wizard; add and populate a Table control in the Report Designer; and format the report Web page. Together, these steps let you create a simple report Web page. For the sake of simplicity, the example in this article uses the Northwind Employees table.&lt;/p&gt; &lt;p&gt;&lt;span class="subhead"&gt;Embed the ReportViewer&lt;/span&gt;&lt;br /&gt;Begin by opening a new file-system Web site and naming it ReportWebTest. Next, open Default.aspx in Design mode and drag a ReportViewer server control from the toolbox's Data category to the form to generate a ReportViewer1 server control (see &lt;a href="http://archive.visualstudiomagazine.com/2006_03/magazine/features/rjennings/Figure1.aspx" target="_blank"&gt;Figure 1&lt;/a&gt;).&lt;/p&gt; &lt;p&gt;Now open ReportViewer1's Report Viewer Tasks smart tag, click on the Design a New Report link to add an empty Report1.rdlc file to the project, and open the Web Site Data Sources window. Next, click on the window's Add New Data Source link to generate a DataSet1.xsd file with an empty TableAdapter and start the Table Adapter Configuration Wizard. Add a new connection to localhost or localhost\SQLEXPRESS with Windows authentication and Northwind as the default database, click on the Next button, and save the connection with its default name, NorthwindConnectionString. Click on the Next button again, accept the default Use SQL Statements option, and click on the Next button to open the Enter a SQL Statement dialog.&lt;/p&gt; &lt;p&gt;Use this T-SQL statement to generate a simple employee roster report:&lt;/p&gt; &lt;pre class="codesnippet"&gt;SELECT EmployeeID, FirstName, LastName, Title,&lt;br /&gt; Country, Extension, Notes FROM Employees&lt;br /&gt;&lt;/pre&gt;    &lt;p&gt;Click on Advanced Options to open the dialog of the same name, clear the Generate Insert, Update and Delete Statements check box, and click on OK. Note that you don't need DataSet update capability for reports. Click on the Next button, accept the default Fill and Get Data Method Names, clear the Create Methods to Send Updates Directly to the Database check box, and click on the Next and Finish buttons to add DataSet1 to the Website Data Sources window—also called the Field List. You don't need code to populate the DataTable when the page loads.&lt;/p&gt;   &lt;p&gt;You're now ready to add and populate a Table control in the Report Designer. Drag a Table control from the Toolbox's Report Items category to the upper left area of Report1.rdlc's empty Body region. The default Table (table1) includes three rows of text boxes—Header, Detail and Footer—and three empty columns. Drag the EmployeeID, LastName, and FirstName field icons from the Website Data Sources window to the text boxes in columns 1, 2 and 3 of the Detail (center) row. Dropping a field in the Detail row adds the formatted field name to the Header text box and an =Fields!FieldName.Value expression to the Detail text box. Right-click on the right-most column header and select Insert Column to the Right to add columns for the Title, Country, and Extension fields (see &lt;a href="http://archive.visualstudiomagazine.com/2006_03/magazine/features/rjennings/Figure2.aspx" target="_blank"&gt;Figure 2&lt;/a&gt;) .&lt;/p&gt;  &lt;p&gt;The report width increases automatically as you add columns. (You add the ntext Notes column after formatting the report and page in the next step, because the width of the Notes column depends on available page width.) Expand the width of ReportViewer1 to about 750px, then press F5 to build and load the page in the ASP.NET Development Server (Cassini). Accept the Modify the Web.config File to Enable Debugging option when the Debugging Not Enabled message box opens, and click on the OK button. If the page is empty, close Internet Explorer (IE) 6.0, return to page Design mode, open the Report Viewer Tasks smart tag, and select Report1.rdlc from the Choose Report list. Next, click on the Choose Data Sources link to open the eponymous dialog and verify that the Data Source Instance is ObjectDataSource1 (see &lt;a href="http://archive.visualstudiomagazine.com/2006_03/magazine/features/rjennings/Figure3.aspx" target="_blank"&gt;Figure 3&lt;/a&gt;). Finally, re-run the report. You'll use these features when you repurpose RDLC files from Windows forms later in the article.&lt;/p&gt; &lt;p&gt;&lt;span class="subhead"&gt;Format the Final Report&lt;/span&gt;&lt;br /&gt;The fourth and final step for embedding a tabular report in a Web form requires formatting the report to optimize consumption of browser real estate for your users' lowest display resolution or browser-window size, which this article's examples and the downloadable sample projects assume to be 800 by 600 pixels. Start by changing ReportViewer1's width property value from 750px to 100%. Unfortunately, you can't set the ReportViewer control's height in percent and specify XHTML 1.0 standards-mode processing. If you set 100% as the height property value, rendering the report in XHTML 1.0 standards-mode displays only the toolstrip; to view the report with quirks-mode rendering, remove this line from the Default.aspx source code:&lt;/p&gt; &lt;pre class="codesnippet"&gt;&lt;br /&gt;&lt;/pre&gt; &lt;p&gt;Be forewarned: There's no guarantee that IE 7.0 will render quirks-mode reports correctly.&lt;/p&gt; &lt;p&gt;Select table1 in the Report Designer, click on the plain button in the Table's upper left corner to display sizing handles, and drag table1 to the upper left corner of the Body section. Click on the Header button to select the Header row, and click on the toolbar's Bold and Underline buttons to emphasize text. Change the Employee ID header to ID, and reduce the column width to 0.25 in.; reduce the Last Name and First Name column width to 0.88 in.; change the Title column width to 1.75 in.; change the Country and Extension headers to Ctry and Ext and the column widths to 0.38 in. Add a column and drag the Notes field to its Details text box; set the column width to 3.13 in. and drag the right edge of the Body section to the right edge of table1. Next, replace Untitled Page with Northwind Traders Employee Roster in the Default.aspx Source window, and press F5 to build and run the project to test your work so far.&lt;/p&gt;   &lt;p&gt;You can delete the report footer row if you want, but that's not required. If you want to add a page header, page footer, or both, simply choose Report | Page Header or Report | Page Footer and add text or expressions. Most Web reports are single-page, so you can simplify the toolstrip by setting ReportViewer1's ShowPageNavigationControls property to False. You can add green-striping to the report by selecting Report1.rdlc's Details row (TableRow2), opening its Properties window, selecting the BackgroundColor property to open the color picker, clicking on the Web tab, and selecting &lt;expression&gt; to open the Edit Expression dialog. Now type this VBA expression in the text box (see &lt;a href="http://archive.visualstudiomagazine.com/2006_03/magazine/features/rjennings/Table1.aspx" target="_blank"&gt;Table 1&lt;/a&gt;):&lt;/expression&gt;&lt;/p&gt; &lt;pre class="codesnippet"&gt;=IIf(RowNumber(Nothing) Mod 2,&lt;br /&gt; "PaleGreen", "White")&lt;br /&gt;&lt;/pre&gt;     &lt;p&gt;Click on OK, then press F5 to build and render the page in IE (see &lt;a href="http://archive.visualstudiomagazine.com/2006_03/magazine/features/rjennings/Figure4.aspx" target="_blank"&gt;Figure 4&lt;/a&gt;). Typing a search term in the text box or selecting a report export format enables the associated link buttons (see &lt;a href="http://archive.visualstudiomagazine.com/2006_03/magazine/features/rjennings/Figure5.aspx" target="_blank"&gt;Figure 5&lt;/a&gt;). Unlike the Windows toolstrip, the Web form toolstrip has no print-related buttons. You set margins and print the report by executing IE's File | Page Setup, File | Print Preview, and File | Print commands.&lt;/p&gt;    &lt;p&gt;&lt;span class="subhead"&gt;Clone Web Report Pages&lt;/span&gt;&lt;br /&gt;Report-oriented Web sites usually have multiple pages, enabling users to navigate easily between related reports without moving to another URL. This design model is similar to a Windows form project, such as ReportSmartClient.sln, that uses pages of a Tab control to display different reports (see &lt;a href="http://archive.visualstudiomagazine.com/2006_03/magazine/features/rjennings/Figure6.aspx" target="_blank"&gt;Figure 6&lt;/a&gt;). Cloning pages for multiple reports saves substantial developer/designer time and effort. After you create a workable starting page, such as NWEmployees.aspx, you can copy and paste the page to the project, and then rename the cloned pages. For example, four of the five pages of the sample ReportWebSite project—NWOrders1997.aspx, NWOrdersChart.aspx, AWEmployees.aspx and AWCategories.aspx—began as clones of NWEmployees.aspx.&lt;/p&gt;     &lt;p&gt;You can copy and paste RDLC files for the original and cloned pages from a corresponding Windows form project. The NWOrders1997Win.rdlc, NWOrdersChartWin.rdlc, AWEmployeesWin.rdlc, and AWCategoriesWin.rdlc files originate in the ReportSmartClient.sln project. Data source instances for Web-based reports differ considerably from their Windows form counterparts, so you must recreate the ObjectDataSource for each report page except AWCategories.aspx. However, you can create the required ObjectDataSource by copying the DataSetName.xsd file from the Windows form project to the Web site's App_Code folder.&lt;/p&gt;     &lt;p&gt;Recreating an ObjectDataSource for a cloned page is simple. Open the ReportViewer Tasks smart tag and select the appropriate RDLC file from the Choose Report list. Most cloned pages have an existing ObjectDataSource1 instance, in which case selecting the new RDLC file adds an ObjectDataSource2 instance. Delete the added instance, open ObjectDataSource1's Tasks smart tag, click on the Configure Data Source link, and verify or change the object name in the Object Data Source Wizard's first dialog. Complete the Wizard's steps, click on the ReportViewer Tasks smart tag's Choose Data Sources link, and verify or change the Data Source Instance to ObjectDataSource1. This technique applies to conventional report pages, such as the ReportWebSite's NWEmployees.aspx, NWOrders1997.aspx, and NWOrdersChart.aspx.&lt;/p&gt;    &lt;p&gt;The AWCategories.aspx page, like the AWCategories tab page of the Windows form project, requires code-behind to create and populate a runtime DataSet's DataTable from an XML data document (see &lt;a href="http://archive.visualstudiomagazine.com/2006_03/magazine/features/rjennings/Listing1.aspx" target="_blank"&gt;Listing 1&lt;/a&gt;). The code to create a runtime, untyped DataSet for the Page_Load event handler is almost identical to that for the Form_Load event handler (see &lt;a href="http://archive.visualstudiomagazine.com/2006_03/magazine/features/rjennings/Listings2.aspx" target="_blank"&gt;Listings 2&lt;/a&gt; and &lt;a href="http://archive.visualstudiomagazine.com/2006_03/magazine/features/rjennings/3.aspx" target="_blank"&gt;3&lt;/a&gt;). AWCategories.aspx illustrates a complex page that includes a background image, a complex matrix report that resembles an Excel PivotTable, and multiple detail charts. Unlike the corresponding Windows form report, the detail charts are bitmaps, so zooming the charts to 75% or smaller makes the charts impossible to read.&lt;/p&gt;&lt;br /&gt;&lt;p&gt; &lt;/p&gt;&lt;/span&gt;&lt;hr align="left" noshade="noshade"  width="600" style="font-size:78%;"&gt; &lt;table style="border: 1px solid rgb(102, 102, 102);" border="1" cellpadding="8" cellspacing="0" width="600"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td class="tabletext" bg="" style="color: rgb(204, 204, 153);" width="600"&gt;    &lt;p&gt;&lt;span class="SideBarTitle"&gt;Use an XML InfoSet Document as a Web ReportViewer Data Source&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Listing 1.&lt;/strong&gt; ReportViewer controls require a typed or untyped DataSet with a DataTable to serve as the report's data source. This code behind the AWCategories.aspx page loads Listing 3's XML data into an untyped, runtime DataSet that's assigned to the ReportViewer's LocalReportDataSources(0) object. The bold attribute emphasizes the modifications required to the corresponding Windows form code. Note that you can't use the "|DataDirectory|" connection string macro, which points to the project's \App_Data folder, in file path statements.&lt;/p&gt;  &lt;hr align="center" noshade="noshade" size="1"&gt;  &lt;pre class="codesnippet"&gt;Imports System&lt;br /&gt;Imports System.Data&lt;br /&gt;Imports Microsoft.Reporting.WebForms&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Partial Class AWCategories&lt;br /&gt; Inherits System.Web.UI.Page&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; Protected Sub Page_Load(ByVal sender As Object,&lt;br /&gt;   ByVal e As System.EventArgs) Handles Me.Load&lt;br /&gt;   If Page.IsPostBack Then&lt;br /&gt;     Return&lt;br /&gt;   End If&lt;br /&gt;   With Me.ReportViewer1&lt;br /&gt;     'Untyped DataSet for the report's DataSource&lt;br /&gt;     Dim dsAwCats As New DataSet&lt;br /&gt;     'Read the XML data into the DataSet&lt;br /&gt;     Dim strPath As String = _&lt;br /&gt;       "\ReportViewer\ReportWebSite\App_Data\"&lt;br /&gt;     dsAwCats.ReadXml(strPath + "AWCategories.xml")&lt;br /&gt;     'Assign the DataTable as the DataSource&lt;br /&gt;     .LocalReport.DataSources.Add(New + _&lt;br /&gt;       ReportDataSource("Sales",&lt;br /&gt;       dsAwCats.Tables(0)))&lt;br /&gt;     'Refresh the report with the new data&lt;br /&gt;     .DataBind()&lt;br /&gt;   End With&lt;br /&gt; End Sub&lt;br /&gt;End Class&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;  &lt;/tbody&gt;&lt;/table&gt;  &lt;br /&gt;&lt;br /&gt;&lt;span id="intelliTXT"&gt;&lt;p&gt;AWEmployees.aspx demonstrates an undocumented problem with data sources that execute SELECT queries. They generate this nasty exception: "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints." You can use the DataTable.GetErrors( ) method to find out what rows and columns have errors, but you might find that eliminating the errors is impossible. Windows forms let you bypass this problem by adding an AdventureWorksDataset.EnforceConstraints = False statement before the Me.AwEmployeesTableAdapter.Fill(Me.AdventureWorksDataset.AWEmployees) method call. Unfortunately, this simple approach doesn't work for Web form reports because their DataSets don't expose the EnforceConstraints property. The upshot of this omission is that you need to create a new AdventureWorksDataset instance and set its EnforceConstraints property value to False, and then generate and fill a new TableAdapter instance (see &lt;a href="http://archive.visualstudiomagazine.com/2006_03/magazine/features/rjennings/Listing4.aspx" target="_blank"&gt;Listing 4&lt;/a&gt;). Issue a ReportViewer1.LocalReport.DataSources.Clear( ) instruction before adding the new DataSet instance with the ReportViewer1.LocalReport.DataSources.Add( ) method. If you don't clear the DataSources, autogenerated C# DataSet designer code will raise the error when processing the required, but unusable, ObjectDataSet.&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;/span&gt;&lt;hr align="left" noshade="noshade"  width="600" style="font-size:78%;"&gt; &lt;table style="border: 1px solid rgb(102, 102, 102);" border="1" cellpadding="8" cellspacing="0" width="600"&gt; &lt;tbody&gt;&lt;tr&gt;&lt;td class="tabletext" bg="" style="color: rgb(204, 204, 153);" width="600"&gt;    &lt;p&gt;&lt;span class="SideBarTitle"&gt;Eliminate Web Forms' "Failed to enable constraints" Exceptions&lt;/span&gt;&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Listing 4.&lt;/strong&gt; Some SELECT queries, such as that for the AWEmployees.rdlc report's data source, throw this exception: "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints." Windows forms let you ignore the exception by adding a DataSetName.EnforceConstraints = False instruction before you invoke the TableAdapterName.Fill( ) method. However, setting the EnforceConstraints property value in a Web form requires creating a new DataSet instance, which requires creating and filling a new TableAdapter.&lt;/p&gt;  &lt;hr align="center" noshade="noshade" size="1"&gt;  &lt;pre class="codesnippet"&gt;Imports System&lt;br /&gt;Imports System.Data&lt;br /&gt;Imports Microsoft.Reporting.WebForms&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Partial Class _Default&lt;br /&gt; Inherits System.Web.UI.Page&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; Protected Sub Page_Load(ByVal sender As Object,&lt;br /&gt;   ByVal e As System.EventArgs) Handles Me.Load&lt;br /&gt;   If Page.IsPostBack Then&lt;br /&gt;     Return&lt;br /&gt;   End If&lt;br /&gt;   Dim dsAdvWorks As New AdventureWorksDataSet&lt;br /&gt;   Dim taEmployees As New&lt;br /&gt;     AdventureWorksDataSetTableAdapters. _&lt;br /&gt;     AWEmployeesTableAdapter&lt;br /&gt;   dsAdvWorks.EnforceConstraints = False&lt;br /&gt;   taEmployees.Fill(dsAdvWorks.AWEmployees)&lt;br /&gt;   With Me.ReportViewer1&lt;br /&gt;     'Remove ObjectDataSource1&lt;br /&gt;     .LocalReport.DataSources.Clear()&lt;br /&gt;     .LocalReport.DataSources.Add(New&lt;br /&gt;     ReportDataSource("AdventureWorks"+_&lt;br /&gt;        "Dataset_AWEmployees",&lt;br /&gt;        dsAdvWorks.Tables(0)))&lt;br /&gt;     'Refresh the report with the new data&lt;br /&gt;     .DataBind()&lt;br /&gt;   End With&lt;br /&gt; End Sub&lt;br /&gt;End Class&lt;/pre&gt; &lt;/td&gt;&lt;/tr&gt;  &lt;/tbody&gt;&lt;/table&gt;&lt;span id="intelliTXT"&gt;&lt;br /&gt;&lt;p&gt;The Report Designer and ReportViewer combination lets you quickly integrate tabular and crosstab reports, as well as charts and graphs, in your .NET 2.0 Windows and Web forms projects. Migrating Windows form RDLC files to corresponding Web-based reports is easy and most cloned Web reports don't require adding code. A limitation of Web reports is the poor readability of zoomed charts and graphs. But the primary ReportViewer drawback for .NET developers is the fact that Microsoft provides even less documentation for Web-based reports than Windows-based reports. Apart from these drawbacks, the .NET 2.0 ReportViewer reports are ready for primetime in Windows and Web forms.&lt;/p&gt;   &lt;/span&gt;   &lt;br /&gt;                                   &lt;p class="articleaboutauthor"&gt;About the Author &lt;/p&gt;                                     &lt;i&gt; Roger Jennings is an independent architect/database developer and writer with more than 1.25 million English copies printed. Roger's latest .NET book is Expert One-on-One Visual Basic 2005 Database Programming (ISBN 0-7645-7678-X) for WROX/Wiley. He''s also a Visual Studio Magazine contributing editor and online columnist, and manages the &lt;a href="http://oakleafblog.blogspot.com/" target="_blank"&gt;OakLeaf Systems blog&lt;/a&gt;. His Code of Federal Regulations Web services won Microsoft''s 2002 .NET Best Horizontal Solution Award. Reach him at &lt;a href="mailto:roger_jennings@compuserve.com"&gt;roger_jennings@compuserve.com&lt;/a&gt;.&lt;/i&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-715776200235098058?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://visualstudiomagazine.com/features/article.aspx?editorialsid=1314' title='Add Reports and Charts to Web Pages'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/715776200235098058/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=715776200235098058&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/715776200235098058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/715776200235098058'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/add-reports-and-charts-to-web-pages.html' title='Add Reports and Charts to Web Pages'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-8198729774798903256</id><published>2007-12-19T14:39:00.000-06:00</published><updated>2007-12-19T14:40:35.363-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='web'/><title type='text'>C# - MultiDropdownFilterService</title><content type='html'>This class implements a filtering plug-in service that will allow the user to filter one or more SqlDataSources, GridViews and/or FormViews by the value selected in one of more DropDownLists.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://docs.google.com/Doc?id=dc49j8fh_3929jq5sw"&gt;Full text here.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-8198729774798903256?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://docs.google.com/Doc?id=dc49j8fh_3929jq5sw' title='C# - MultiDropdownFilterService'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/8198729774798903256/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=8198729774798903256&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/8198729774798903256'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/8198729774798903256'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/c-multidropdownfilterservice.html' title='C# - MultiDropdownFilterService'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-615188445469237186</id><published>2007-12-19T13:52:00.001-06:00</published><updated>2007-12-19T13:54:43.566-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='quick reference'/><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>VB.NET and C# Comparison</title><content type='html'>&lt;span style="font-size:78%;"&gt;&lt;a href="http://www.harding.edu/fmccown/vbnet_csharp_comparison.html"&gt;This is a quick reference guide to highlight some key syntactical differences between VB.NET (version 2) and C#. Very useful!&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.harding.edu/fmccown/java1_5_csharp_comparison.html"&gt;Check out the Java (J2SE 5.0) and C# comparison too!&lt;/a&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-615188445469237186?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='related' href='http://www.harding.edu/fmccown/vbnet_csharp_comparison.html' title='VB.NET and C# Comparison'/><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/615188445469237186/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=615188445469237186&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/615188445469237186'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/615188445469237186'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/vbnet-and-c-comparison.html' title='VB.NET and C# Comparison'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-1016597527090882477</id><published>2007-12-18T21:46:00.000-06:00</published><updated>2007-12-19T00:15:53.767-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dates'/><title type='text'>Two articles on datetimes</title><content type='html'>&lt;b&gt;Two articles on datetimes&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.karaszi.com/sqlserver/info_datetime.asp"&gt;The ultimate guide to the datetime datatypes&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.tondering.dk/claus/cal/"&gt;Frequently Asked Questions about Calendars, by Claus Tøndering&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-1016597527090882477?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/1016597527090882477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=1016597527090882477&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/1016597527090882477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/1016597527090882477'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/two-articles-on-datetimes.html' title='Two articles on datetimes'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-3926242200435900207</id><published>2007-12-18T21:39:00.000-06:00</published><updated>2007-12-18T21:46:51.824-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='asp'/><title type='text'>ASP.NET Performance Tuning Tips</title><content type='html'>&lt;b&gt;ASP.NET Performance Tuning Tips&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Any programming model has its common performance pitfalls, and ASP.NET is no exception. This section describes some of the ways in which you can avoid performance bottlenecks in your code.&lt;br /&gt;&lt;br /&gt;Disable Session State when not in use: Not all applications or pages require per-user session state. If it is not required, disable it completely. This is easily accomplished using a page-level directive, such as the following:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%@ Page EnableSessionState="false" %&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note: If a page requires access to session variables but does not create or modify them, set the value of the directive to ReadOnly. Session State can also be disabled for XML Web service methods. See &lt;a href="http://samples.gotdotnet.com/quickstart/aspplus/doc/servicesandobjs.aspx"&gt;Using Objects and Intrinsics&lt;/a&gt; in the XML Web services section.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Choose your Session State provider carefully: ASP.NET provides three distinct ways to store session data for your application: in-process session state, out-of-process session state as a Windows Service, and out-of-process session state in a SQL database. Each has its advantages, but in-process session state is by far the fastest solution. If you are only storing small amounts of volatile data in session state you should use the in-process provider. The out-of-process solutions are primarily useful in Web garden and Web farm scenarios or in situations in which data cannot be lost in the event of a server/process restart.&lt;br /&gt;&lt;br /&gt;Avoid excessive round trips to the server: The Web Forms page framework is one of the best features of ASP.NET, because it can dramatically reduce the amount of code you need to write to accomplish a task. Programmatic access to page elements using server controls and the postback event handling model are arguably the most time-saving features. However, there are appropriate and inappropriate ways to use these features, and it is important to know when it is appropriate to use them.&lt;br /&gt;An application typically needs to make a round trip to the server only when retrieving data or storing data. Most data manipulations can take place on the client between round trips. For example, validating form entries can often take place on the client before the user submits data. In general, if you do not need to relay information back to the server, then you should not make a round trip to the server.&lt;br /&gt;&lt;br /&gt;If you are writing your own server controls, consider having them render client-side code for up-level (ECMAScript-capable) browsers. By employing "smart" controls, you can dramatically reduce the number of unecessary hits to your Web server.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Use Page.IsPostback to avoid extra work on a round trip: If you are handling server control postbacks, you often need to execute different code the first time the page is requested from the code you do use for the round trip when an event is fired. If you check the Page.IsPostBack property, your code can execute conditionally, depending on whether there is an initial request for the page or a responce to a server control event. It might seem obvious to do this, but in practice it is possible to omit this check without changing the behavior of the page. For example:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script language="C#" runat="server"&amp;gt;&lt;br /&gt;&lt;br /&gt;   public DataSet ds;&lt;br /&gt;   ...&lt;br /&gt;&lt;br /&gt;   void Page_Load(Object sender, EventArgs e) {&lt;br /&gt;       // ...set up a connection and command here...&lt;br /&gt;       if (!Page.IsPostBack) {&lt;br /&gt;           String query = "select * from Authors where FirstName like '%JUSTIN%'";&lt;br /&gt;           myCommand.Fill(ds, "Authors");&lt;br /&gt;           myDataGrid.DataBind();&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   void Button_Click(Object sender, EventArgs e) {&lt;br /&gt;       String query = "select * from Authors where FirstName like '%BRAD%'";&lt;br /&gt;       myCommand.Fill(ds, "Authors");&lt;br /&gt;       myDataGrid.DataBind();&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;form runat="server"&amp;gt;&lt;br /&gt; &amp;lt;sp:datagrid datasource='&amp;lt;%# ds.DefaultView %&amp;gt;' runat="server"/&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt; &amp;lt;sp:button onclick="Button_Click" runat="server"/&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Page_Load event executes on every request, so we checked Page.IsPostBack so that the first query does not execute when we process the Button_Click event postback. Note that even without this check our page would behave identically, since the binding from the first query would be overturned by the call to DataBind in the event handler. Keep in mind that it can be easy to overlook this simple performance improvement when you write your pages.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Use server controls sparingly and appropriately: Even though it is extremely easy to use, a server control might not always be the best choice. In many cases, a simple rendering or databinding substitution will accomplish the same thing. For example:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script language="C#" runat="server"&amp;gt;&lt;br /&gt;&lt;br /&gt;   public String imagePath;&lt;br /&gt;   void Page_Load(Object sender, EventArgs e) {&lt;br /&gt;       //...retrieve data for imagePath here...&lt;br /&gt;       DataBind();&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%-- the span and img server controls are unecessary...--%&amp;gt;&lt;br /&gt;The path to the image is: &amp;lt;span innerhtml='&amp;lt;%# imagePath %&amp;gt;' runat="server"/&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;&amp;lt;img src='&amp;lt;%# imagePath %&amp;gt;' runat="server"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%-- use databinding to substitute literals instead...--%&amp;gt;&lt;br /&gt;The path to the image is: &amp;lt;%# imagePath %&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;&amp;lt;img src='&amp;lt;%# imagePath %&amp;gt;' /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%-- or a simple rendering expression...--%&amp;gt;&lt;br /&gt;The path to the image is: &amp;lt;%= imagePath %&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;&amp;lt;img src='&amp;lt;%= imagePath %&amp;gt;' /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In this example, a server control is not needed to substitute values into the resulting HTML sent back to the client. There are many other cases where this technique works just fine, even in server control templates. However, if you want to programmatically manipulate the control's properties, handle events from it, or take advantage of its state preservation, then a server control would be appropriate. You should examine your use of server controls and look for code you can optimize.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Avoid excessive server control view state: Automatic state management is a feature that enables server controls to re-populate their values on a round trip without requiring you to write any code. This feature is not free however, since the state of a control is passed to and from the server in a hidden form field. You should be aware of when ViewState is helping you and when it is not. For example, if you are binding a control to data on every round trip (as in the datagrid example in tip #4), then you do not need the control to maintain it's view state, since you will wipe out any re-populated data in any case.&lt;br /&gt;ViewState is enabled for all server controls by default. To disable it, set the EnableViewState property of the control to false, as in the following example:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;sp:datagrid EnableViewState="false" datasource="..." runat="server"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can also turn ViewState off at the page level. This is useful when you do not post back from a page at all, as in the following example:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%@ Page EnableViewState="false" %&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note that this attribute is also supported by the User Control directive. To analyze the amount of view state used by the server controls on your page, enable tracing and look at the View State column of the Control Hierarchy table. For more information about the Trace feature and how to enable it, see the Application-level Trace Logging feature.&lt;br /&gt;&lt;br /&gt;Use Response.Write for String concatenation: Use the HttpResponse.Write method in your pages or user controls for string concatenation. This method offers buffering and concatenation services that are very efficient. If you are performing extensive concatenation, however, the technique in the following example, using multiple calls to Response.Write, is faster than concatenating a string with a single call to the Response.Write method.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Response.Write("a");&lt;br /&gt;Response.Write(myString);&lt;br /&gt;Response.Write("b");&lt;br /&gt;Response.Write(myObj.ToString());&lt;br /&gt;Response.Write("c");&lt;br /&gt;Response.Write(myString2);&lt;br /&gt;Response.Write("d");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Do not rely on exceptions in your code: Exceptions are very expensive and should rarely occur in your code. You should never use exceptions as a way to control normal program flow. If it is possible to detect in code a condition that would cause an exception, you should do that instead of waiting to catch the exception before handling that condition. Common scenarios include checking for null, assigning to a string that will be parsed into a numeric value, or checking for specific values before applying math operations. For example:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// Consider changing this:&lt;br /&gt;&lt;br /&gt;try {&lt;br /&gt;  result = 100 / num;&lt;br /&gt;}&lt;br /&gt;catch (Exception e) {&lt;br /&gt; result = 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// To this:&lt;br /&gt;&lt;br /&gt;if (num != 0)&lt;br /&gt;  result = 100 / num;&lt;br /&gt;else&lt;br /&gt; result = 0;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Use early binding in Visual Basic or JScript code: One of the advantages of Visual Basic, VBScript, and JScript is their typeless nature. Variables can be created simply by using them and need no explicit type declaration. When assigning from one type to another, conversions are performed automatically, as well. This can be both an advantage and a disadvantage, since late binding is a very expensive convenience in terms of performance.&lt;br /&gt;The Visual Basic language now supports type-safe programming through the use of a special Option Strict compiler directive. For backward compatibility, ASP.NET does not enable Option Strict by default. However, for optimal perfomance, you should enable Option Strict for your pages by using a Strict attribute on the page or Control directive:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%@ Page Language="VB" Strict="true" %&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%&lt;br /&gt;&lt;br /&gt;Dim B&lt;br /&gt;Dim C As String&lt;br /&gt;&lt;br /&gt;' This causes a compiler error:&lt;br /&gt;A = "Hello"&lt;br /&gt;&lt;br /&gt;' This causes a compiler error:&lt;br /&gt;B = "World"&lt;br /&gt;&lt;br /&gt;' This does not:&lt;br /&gt;C = "!!!!!!"&lt;br /&gt;&lt;br /&gt;' But this does:&lt;br /&gt;C = 0&lt;br /&gt;&lt;br /&gt;%&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;JScript also supports typeless programming, though it offers no compiler directive to force early binding. A variable is late-bound if:&lt;br /&gt;It is declared explicitly as an object.&lt;br /&gt;It is a field of a class with no type declaration.&lt;br /&gt;It is a private function/method member with no explicit type declaration and the type cannot be inferred from its use.&lt;br /&gt;The last distinction is complicated. The JScript compiler optimizes if it can figure out the type, based on how a variable is used. In the following example, the variable A is early-bound but the variable B is late-bound:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var A;&lt;br /&gt;var B;&lt;br /&gt;&lt;br /&gt;A = "Hello";&lt;br /&gt;B = "World";&lt;br /&gt;B = 0;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For the best performance, declare your JScript variables as having a type. For example, "var A : String".&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Port call-intensive COM components to managed code: The .NET Framework provides a remarkably easy way to interoperate with traditional COM components. The benefit is that you can take advantage of the new platform while preserving your existing code. However, there are some circumstances in which the performance cost of keeping your old components is greater than the cost to migrate your components to managed code. Every situation is unique, and the best way to decide what needs to be changed is to measure site performance. In general, however, the performance impact of COM interoperability is proportional to the number of function calls made or the amount of data marshaled from unmanaged to managed code. A component that requires a high volume of calls to interact with it is called "chatty," due to the number of communications between layers. You should consider porting such components to fully managed code to benefit from the performance gains provided by the .NET platform. Alternatively, you might consider redesigning your component to require fewer calls or to marshal more data at once.&lt;br /&gt;&lt;br /&gt;Use SQL stored procedures for data access: Of all the data access methods provided by the .NET Framework, SQL-based data access is the best choice for building scalable web applications with the best performance. When using the managed SQL provider, you can get an additional performance boost by using compiled stored procedures instead of ad hoc queries. For an example of using SQL stored procedures, refer to the &lt;a href="http://samples.gotdotnet.com/quickstart/aspplus/doc/webdataaccess.aspx"&gt;Server-Side Data Access&lt;/a&gt; section of this tutorial.&lt;br /&gt;&lt;br /&gt;Use SqlDataReader for a fast-forward, read-only data cursor: A SqlDataReader object provides a forward, read-only cursor over data retrieved from a SQL database. SqlDataReader is a more performant option than using a DataSet if it can be used for your scenario. Because SqlDataReader supports the IEnumerable interface, you can even bind server controls, as well. For an example of using SqlDataReader, see the &lt;a href="http://samples.gotdotnet.com/quickstart/aspplus/doc/webdataaccess.aspx"&gt;Server-Side Data Access&lt;/a&gt; section of this tutorial.&lt;br /&gt;&lt;br /&gt;Cache data and output wherever possible: The ASP.NET programming model provides a simple mechanism for caching page output or data when it does not need to be dynamically computed for every request. You can design your pages with caching in mind to optimize those places in your application that you expect to have the most traffic. More than any feature of the .NET Framework, the appropriate use of caching can enhance the performance of your site, sometimes by an order of magnitude or more. For more information about how to use caching, see the &lt;a href="http://samples.gotdotnet.com/quickstart/aspplus/doc/cachingoverview.aspx"&gt;Cache Services&lt;/a&gt; section of this tutorial.&lt;br /&gt;&lt;br /&gt;Enable Web gardening for multiprocessor computers: The ASP.NET process model helps enable scalability on multiprocessor machines by distributing the work to several processes, one for each CPU, each with processor affinity set to its CPU. The technique is called Web gardening, and can dramatically improve the performance of some applications. To learn how to enable Web gardening, refer to the &lt;a href="http://samples.gotdotnet.com/quickstart/aspplus/doc/procmodel.aspx"&gt;Using the Process Model&lt;/a&gt; section.&lt;br /&gt;&lt;br /&gt;Do not forget to disable Debug mode: The &amp;lt;compilation&amp;gt; section in ASP.NET configuration controls whether an application is compiled in Debug mode, or not. Debug mode degrades performance significantly. Always remember to disable Debug mode before you deploy a production application or measure performance. For more information about Debug mode, refer to the section entitled &lt;a href="http://samples.gotdotnet.com/quickstart/aspplus/doc/debugcomsdk.aspx"&gt;The SDK Debugger&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-3926242200435900207?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/3926242200435900207/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=3926242200435900207&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/3926242200435900207'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/3926242200435900207'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/aspnet-performance-tuning-tips.html' title='ASP.NET Performance Tuning Tips'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-7546848968989290876</id><published>2007-12-18T21:38:00.000-06:00</published><updated>2007-12-18T21:47:57.513-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='dates'/><category scheme='http://www.blogger.com/atom/ns#' term='julian'/><title type='text'>A Short History of the Calendar (and Julian dates)</title><content type='html'>&lt;p&gt;       &lt;b&gt;A Short History of the Calendar&lt;/b&gt;&lt;br /&gt;Excerpt from Joe Celko's Data and Databases: Concepts in Practice&lt;br /&gt;&lt;br /&gt;The Western world is and has been on a solar calendar. That means a year is defined as one revolution of the earth around the sun. Unfortunately, this revolution is not an even number of days (one solar year = 365.2422 days) and therefore solar calendars drift out of alignment unless corrected.&lt;br /&gt;&lt;br /&gt;The Egyptian calendar drifted &lt;i&gt;completely around&lt;/i&gt; approximately every 1,461 years and made two complete cycles from its introduction to the time of Julius Caesar. As a result, this calendar was useless for agriculture. The Egyptians relied on the stars to predict the flooding of the Nile. Julius Caesar decreed that the year 708 AUC (&lt;i&gt;ab urbis conditae&lt;/i&gt; from the founding of the city of Rome, or 46 BCE) had 445 days in order to realign the calendar with the seasons. Leap years were referred to as bissextile years.&lt;br /&gt;&lt;br /&gt;Julius Caesar, on the advice of Sosigenes of Alexandria, also introduced leap years in 708 AUC (they did not exist in solar calendars prior to then). This calendar became known as the Julian calendar. The year 46 BCE was called the &lt;i&gt;Year of Confusion&lt;/i&gt; by the Romans. &lt;br /&gt;&lt;br /&gt;Over the next several centuries, months were added to the year, and days were added and subtracted from the months by assorted Romans, until the Christians had control over the calendar. The problem with the Julian calendar was that it used a simple four-year leap year cycle. It drifted by approximately 3 days every 400 years and had gotten 10 days out of step with the seasons by 1582.&lt;br /&gt;&lt;br /&gt;However, you might want to remember that a Roman calendar without a leap year would have drifted ‘completely around’ slightly more than once between 708 AUC and 2335 AUC (1582 CE). The summer solstice, so important to planting crops, had no relationship to June 21 by 1582, so Pope Gregory took two weeks out of the month of October in 1582 to realign things. (A thousand years before Pope Gregory, the Aztecs and Mayans knew the number of days in a solar year to three decimal places.)&lt;br /&gt;&lt;br /&gt;The Gregorian calendar is now properly known as the &lt;i&gt;Common Era&lt;/i&gt; calendar to avoid religious references that might confuse non-Christians. What used to be &lt;i&gt;AD&lt;/i&gt; and &lt;i&gt;BC&lt;/i&gt; are now properly abbreviated as &lt;i&gt;CE&lt;/i&gt; and &lt;i&gt;BCE.&lt;/i&gt; &lt;br /&gt;&lt;br /&gt;The transition from the old Julian calendar to the Gregorian calendar took place at different times in different countries: &lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="post-body"&gt;&lt;li&gt; The Italian duchies and kingdoms, Catholic parts of Switzerland, Spain, and Portugal (at that time under the same king, Philip II), including their colonies, skipped from 1582 October 4 to 1582 October 15.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; France (including its colonies) skipped from 1582 December 9 to 1582 December 20. &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Poland skipped from 1582 October 4 to 1582 October 15. &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; German-Roman Empire (the Habsburgs in Austria): in 1583. &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; German duchies with Catholic confession: in 1583. &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; German duchies with Protestant confession skipped from 1700 February 18 to 1700 March 1. &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Netherlands: in 1700. &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Protestant parts of Switzerland: in 1701. &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Denmark and Norway skipped from 1700 February 18 to 1700 March 1. &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Sweden and Finland skipped from 1753 February 17 to 1753 March 1, but were one day apart from the old calendar between 1700 and 1712! (that is, 1700 February 28 was followed by 1700 March 1, and 1712 February 29 was followed by 1712 February 30, which was followed by 1712 March 1).&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Great Britain and its colonies skipped from 1752 September 2 to 1752 September 14. &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; Russia and the former Soviet Union skipped from 1918 January 18 to 1918 February 1 (therefore, the October Revolution took place 1917 November 7 in the Gregorian calendar).&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt; The Balkan nations switched between 1918 and 1924.  &lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Julian Date&lt;/b&gt;  &lt;br /&gt;&lt;br /&gt;If you’re going to use universal dates, think big and use Julian dates. The Julian date is a number set up by astronomers that currently is seven digits long. It ranges from 4713 January 01 BCE through 27,378 CE, which ought to be enough for any database application. The use of the starting date of 4713 January 01 BCE is related to solar and lunar cycles. This format avoids some problems, such as finding the day of the week (take the Julian date modulo 7) and leap year conversions. Durations are calculated by simple subtraction and addition. Finding the phase of the moon, lunar eclipses, solar eclipses, and other astronomical facts is fairly simple algebra which is why astronomers use it. The downside is that existing systems, both legal and computer, would need to be rewritten. &lt;/li&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-7546848968989290876?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/7546848968989290876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=7546848968989290876&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/7546848968989290876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/7546848968989290876'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/short-history-of-calendar-and-julian.html' title='A Short History of the Calendar (and Julian dates)'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-6828051653657102785</id><published>2007-12-18T21:37:00.001-06:00</published><updated>2007-12-18T21:37:15.567-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='windows XP'/><title type='text'>Unneeded Services on Windows XP</title><content type='html'>&lt;strong&gt;Unneeded Services on Windows XP &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Windows &amp;amp; .NET Magazine December 2003 pg. 88  &lt;br /&gt;Author(s) Michael Otey &lt;br /&gt;&lt;br /&gt;The code-bloat problem seems to get worse with every release of Windows—each new release seems to run slower than the preceding one. In most cases, the problem doesn't stem from the base OS code but from the fact that each new release tends to incorporate more functionality. One key area that continues to expand is services: Windows XP automatically starts 36 services. Few users need all those services, however, and by trimming back unused services, you can make your system run more efficiently.&lt;br /&gt;&lt;br /&gt;To disable a service, open the Control Panel Services applet and double-click the service to open its Properties sheet. On the General tab, click the Startup type drop-down box and select Disabled. If you discover that you've lost important functionality, restart the service by resetting its Startup type to Automatic or Manual. Here are 10 XP services that you can consider turning off.&lt;br /&gt;&lt;br /&gt;10. Automatic Updates service—Some users depend on Microsoft's Automatic Updates to keep their systems up-to-date and will want to leave this service enabled. Personally, I like to be in control of the updates that are applied to my systems, so I turn off Automatic Updates.&lt;br /&gt;&lt;br /&gt;9. Messenger service—The Messenger service sends and receives messages that the Net Send command or the Alerter service has transmitted. If you don't use the Net Send function or receive Alerter messages, you can safely disable this service.&lt;br /&gt;&lt;br /&gt;8.TCP/IP NetBIOS Helper service—If you're still running WINS and NetBIOS on your network, you'll want the TCP/IP NetBios Helper service to remain enabled. However, if you run only TCP/IP, you can probably eliminate this service.&lt;br /&gt;&lt;br /&gt;7. Wireless Zero Configuration service—As its name suggests, the Wireless Zero Configuration service supports automatic configuration of 802.11 wireless connections. Mobile users of laptops and tablet PCs should probably leave this service active, but networked client systems usually have no need for wireless connections and can safely disable the service.&lt;br /&gt;&lt;br /&gt;6. Upload Manager service—The Upload Manager service performs asynchronous file transfers. This service lets your system send Microsoft information that's used to search for drivers for your system. I prefer to explicitly manage the drivers I use, so I disable the Upload Manager service.&lt;br /&gt;&lt;br /&gt;5. Task Scheduler service—The Task Scheduler lets your system automatically run programs and scripts at a prescheduled time. Some third-party virus scanners and backup utilities use this service; others install their own scheduling service. To see whether anything on your system uses this service, open the Scheduled Tasks folder in Control Panel. If the folder is empty, you probably can disable Task Scheduler without sacrificing functionality.&lt;br /&gt;&lt;br /&gt;4. Error Reporting service—The Error Reporting service contacts Microsoft when applications encounter an error. At first, I thought this service was cool, but after taking the time to send an error report to Microsoft several dozen times for a variety of problems with no visible result, I gave up on this service as more trouble than it's worth.&lt;br /&gt;&lt;br /&gt;3. Remote Registry service—The Remote Registry service lets you access and manipulate the registry on other networked systems. This service can be useful on administrative workstations, but it can also be a potentially serious security exposure on end users' network clients. I recommend disabling the Remote Registry service on most client systems.&lt;br /&gt;&lt;br /&gt;2. Server service—The Server service provides remote procedure call (RPC) support as well as support for file and print serving. Although this service is necessary on server systems, it can pose a security risk on network clients that don't need to provide file and print serving.&lt;br /&gt;&lt;br /&gt;1. Computer Browser service—The Computer Browser service maintains and publishes to network clients a list of computers that are on the network. Although this service is useful on one or two key servers, network clients usually shouldn't run this service.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-6828051653657102785?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/6828051653657102785/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=6828051653657102785&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/6828051653657102785'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/6828051653657102785'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/unneeded-services-on-windows-xp.html' title='Unneeded Services on Windows XP'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-9212917999334553404</id><published>2007-12-18T21:35:00.001-06:00</published><updated>2007-12-18T21:35:33.930-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='.net'/><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Good Articles about passing many arguments to a stored procedure</title><content type='html'>&lt;b&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;Good Articles about passing many arguments to a stored procedure&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Have you ever wanted to pass a DataTable, or array, containing tens or tens of thousands (or even millions) of records, into a SQL Server2000 stored procedure in just one database call? Ever wanted to pass a list of IDs of records to select or delete into a SP? Then read on.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.codeproject.com/cs/database/PassingArraysIntoSPs.asp"&gt;Passing an array or DataTable into a stored procedure&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://vyaskn.tripod.com/passing_arrays_to_stored_procedures.htm"&gt;How to pass a list of values or array to SQL Server stored procedure&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;script language="javascript"&gt;document.write( '&lt;a href="http://groups.google.com/groups?as_umsgid=' + escape( "&gt;Multi-table insert/update using XML&lt;/a&gt;' );&lt;/script&gt;&lt;a href="http://groups.google.com/groups?as_umsgid=%2376g0%24JvBHA.2148@tkmsftngp02"&gt;Multi-table insert/update using XML&lt;/a&gt;&lt;br /&gt;&lt;/i&gt;&lt;/b&gt;&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-9212917999334553404?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/9212917999334553404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=9212917999334553404&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/9212917999334553404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/9212917999334553404'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/good-articles-about-passing-many.html' title='Good Articles about passing many arguments to a stored procedure'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-5199839083656281969</id><published>2007-12-18T21:29:00.001-06:00</published><updated>2007-12-18T21:29:20.616-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sybase'/><title type='text'>Simulating dynamic SQL in ASE</title><content type='html'>&lt;b&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;Simulating dynamic SQL in ASE &lt;/b&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;With a certain regularity, Sybase users ask questions like "How can I use dynamic SQL in ASE ?" in the Sybase-related newsgroups. There are a number of different answers to this question.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;The elegant way: execute-immediate (ASE 12.0+)&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;First, if you're running ASE 12.0 or later, you can use the execute immediate feature, which gives you full dynamic SQL capabilites, as it lets you execute dynamically generated SQL command strings. A simple example:&lt;br /&gt;declare @c varchar(25)&lt;br /&gt;select @c = "select getdate()"&lt;br /&gt;exec (@c)&lt;br /&gt;&lt;br /&gt;While this example is hardly something to get excited about, execute-immediate has opened a new dimension to the sort of thing you can do with T-SQL. The most important characteristic is that you can now create stored procedures (and triggers) that are independent of the schema of tables -- a highly useful thing to do.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;The clumsy way: simulate dynamic SQL(ASE pre-12.0)&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;First, If you don't have ASE 12.0, (so you're on version 11.9.x or before), then your ASE version won't support dynamic SQL. However, you can still simulate certain types of dynamic SQL statements through a variety of tricks. These will work in ASE 11.9.x and earlier versions, and even in old stuff such as version 4.9.x.&lt;br /&gt;&lt;br /&gt;These are different ways of doing this:&lt;br /&gt;&lt;br /&gt;If you're using ASE version 11.5.x or 11.9.x, you can simulate dynamic SQL by using the CIS-related stored procedure sp_remotesql. You'll need to use a backdoor trick which has some drawbacks, but otherwise works very well. It also provides almost as much functionality as the execute immediate in ASE 12.0, but it's quite a bit more complicated to get it all set up. Go here to get details on how to set this up and download some examples.&lt;br /&gt;&lt;br /&gt;For any version of ASE, including 4.9.x, 10, 11.0, 11.5 and 11.9, you can achieve quite a few things by creatively employing existing commands and procedures. However, note the following: while offering some possibly useful ideas, there are significant limitations on what's possible with this approach, so this is mainly aimed at inspiration rather than at solving a wide range of real-life problems.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Creating a table with a variable name&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;While the pre-12.0 Sybase Transact-SQL syntax does not allow you to use a variable for the table name in the create table statement, it is possible to achieve the same result with the following sequence:&lt;br /&gt;&lt;br /&gt;create table some_unused_name &lt;br /&gt;      ( column_1 int, column_2 varchar(80) )&lt;br /&gt;&lt;br /&gt;exec sp_rename "some_unused_name",&lt;br /&gt;              "the_final_table_name"&lt;br /&gt;&lt;br /&gt;By putting these statements in a stored procedure, you can effectively create a table with a variable name. &lt;br /&gt;Note that you can also rename the columns of the newly created table:&lt;br /&gt;&lt;br /&gt;exec sp_rename "final_table_name.column_1",&lt;br /&gt;              "Column_Number_One"&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sypron.nl/dynsql.html"&gt;CHECK MORE OF THIS ON http://www.sypron.nl/dynsql.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Simulating dynamic SQL through CIS&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;This is a demo of how you can use certain CIS (Component Integration Services) features in ASE 11.5 or 11.9 to simulate dynamic SQL.&lt;br /&gt;&lt;br /&gt;ASE 12.0 contains a new feature called execute immediate which lets you execute a text string containing dynamically created SQL queries; however, this isn't possible in ASE 11.5.x or 11.9.x. This demo shows how to achieve basically the same functionality in ASE 11.5.x / 11.9.x.&lt;br /&gt;&lt;br /&gt;Below on this page, you can download SQL scripts which will create a stored procedure named sp_exec_dynsql. This procedure takes a text string as an argument and executes the SQL statements contained in the text string. Here's an example: the below procedure myproc takes two arguments, being a column name and a table name. It will then select the specified column from the specified table using sp_exec_dynsql:&lt;br /&gt;&lt;br /&gt;create procedure myproc&lt;br /&gt;  @col_name varchar(32),&lt;br /&gt;  @tab_name varchar(70)&lt;br /&gt;as&lt;br /&gt;begin&lt;br /&gt;  declare @cmd varchar(255)&lt;br /&gt;  select @cmd = "select " + @col_name +&lt;br /&gt;                "from " + @tab_name&lt;br /&gt;  exec sp_exec_dynsql @cmd&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;You can then do things like: &lt;br /&gt;1&gt; exec myproc "pub_name", "pubs2..publishers"&lt;br /&gt;2&gt; go&lt;br /&gt;           &lt;br /&gt;pub_name&lt;br /&gt;----------------------------------------&lt;br /&gt;New Age Books&lt;br /&gt;Binnet &amp;amp; Hardley&lt;br /&gt;Algodata Infosystems&lt;br /&gt;           &lt;br /&gt;(3 rows affected)&lt;br /&gt;&lt;br /&gt;Behind the scenes, this works as follows: using a CIS-related trick, you can access the local server as if it were a remote server. You can then use sp_remotesql to execute any command string in that not-so-remote server. Because sp_remotesql takes a text string as an argument, you can create any SQL statement dynamically and then execute it.&lt;br /&gt;Note that you must be running ASE 11.5 or later (earlier versions do not have the CIS functionality included), and you must run set up the server for these tricks to work.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sypron.nl/dynsqlcis.html"&gt;CHECK MORE OF THIS ON http://www.sypron.nl/dynsqlcis.html&lt;/a&gt; &lt;/i&gt;&lt;/b&gt;&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-5199839083656281969?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/5199839083656281969/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=5199839083656281969&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/5199839083656281969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/5199839083656281969'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/simulating-dynamic-sql-in-ase.html' title='Simulating dynamic SQL in ASE'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-6042057826235301054</id><published>2007-12-18T21:28:00.001-06:00</published><updated>2007-12-18T21:28:52.365-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sybase'/><category scheme='http://www.blogger.com/atom/ns#' term='xml'/><title type='text'>Converting SQL result sets to XML in Sybase ASE</title><content type='html'>&lt;b&gt;&lt;b&gt;&lt;i&gt;&lt;b&gt;Converting SQL result sets to XML in Sybase ASE&lt;/b&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;There is a growing interest among ASE users for combining SQL and XML. Perhaps the most common requirement is to represent an SQL result set in XML format. There are a number of ways of doing this:&lt;br /&gt;ASE 12.5.1: ASE 12.5.1 comes with a completely new implementation of XML inside ASE. Unlike earlier attempts at XML-in-ASE, 12.5.1 does not use Java-in-ASE this new 'native' XML functionality (actually, it does use Java for some of the minor features, but the main functionality doesn't).&lt;br /&gt;&lt;br /&gt;Among many other things (like XPath/XQuery support), this new feature lets you turn an SQL result set into an XML document by simply adding the for xml clause to a select statement:&lt;br /&gt;1&gt; select pub_id, pub_name from publishers for xml&lt;br /&gt;2&gt; go&lt;br /&gt;&lt;br /&gt;&lt;resultset xmlns:xsi="http://www.w3.org/2001/&lt;br /&gt;XMLSchema-instance"&gt;&lt;br /&gt;&lt;row&gt;&lt;br /&gt;  &lt;pub_id&gt;0736&lt;/pub_id&gt;&lt;br /&gt;  &lt;pub_name&gt;New Age Books&lt;/pub_name&gt;&lt;br /&gt;&lt;/row&gt;&lt;br /&gt;&lt;row&gt;&lt;br /&gt;  &lt;pub_id&gt;0877&lt;/pub_id&gt;&lt;br /&gt;  &lt;pub_name&gt;Binnet &amp;amp; Hardley&lt;/pub_name&gt;&lt;br /&gt;&lt;/row&gt;&lt;br /&gt;&lt;row&gt;&lt;br /&gt;  &lt;pub_id&gt;1389&lt;/pub_id&gt;&lt;br /&gt;  &lt;pub_name&gt;Algodata Infosystems&lt;/pub_name&gt;&lt;br /&gt;&lt;/row&gt;&lt;br /&gt;&lt;/resultset&gt;&lt;br /&gt;&lt;br /&gt;To extract elements from an XML document, use the xmlextract() function: &lt;br /&gt;-- first create some test data&lt;br /&gt;create table MyXMLTab (id int, xmldoc text)&lt;br /&gt;go&lt;br /&gt;&lt;br /&gt;insert MyXMLTab values (1, &lt;br /&gt;'&lt;pubs&gt;&lt;pub_id&gt;0736&lt;/pub_id&gt;&lt;br /&gt;&lt;pub_name&gt;New Age Books&lt;/pub_name&gt;&lt;/pubs&gt;')&lt;br /&gt;&lt;br /&gt;insert MyXMLTab values (2, &lt;br /&gt;'&lt;pubs&gt;&lt;pub_id&gt;1389&lt;/pub_id&gt;&lt;br /&gt;&lt;pub_name&gt;Algodata Infosystems&lt;/pub_name&gt;&lt;/pubs&gt;')&lt;br /&gt;go&lt;br /&gt;&lt;br /&gt;-- now retrieve the data&lt;br /&gt;1&gt; select  &lt;br /&gt;2&gt;   pub_id = xmlextract("//pubs/pub_id/text()", xmldoc), &lt;br /&gt;3&gt;   pub_id_tag = xmlextract("//pubs/pub_id", xmldoc) &lt;br /&gt;4&gt; from MyXMLTab where id = 2&lt;br /&gt;5&gt; go&lt;br /&gt;&lt;br /&gt;pub_id pub_id_tag&lt;br /&gt;------ ---------------------&lt;br /&gt;0877   &lt;pub_id&gt;0877&lt;/pub_id&gt;&lt;br /&gt;&lt;br /&gt;Note how the text() function strips the XML tags from the XML element. Also note that the returned value is still a text string, so if conversion to a numeric datatype is desired, this should still be done explicitly with convert().&lt;br /&gt;&lt;br /&gt;This is only a brief example of the XML functionality in 12.5.1+. Many more functions exist; full details can be found in the ASE product documentation.&lt;br /&gt;The XML stuff in 12.5.1 is a licensable feature, but fortunately, it is included in the free Developer's Edition of 12.5.1. ASE 12.5.1 also supports web services, which is based on this XML functionality.&lt;br /&gt;ASE pre-12.5.1: In pre-12.5.1, ASE supports XML/XQL based on the Java functionality in ASE. This works well provided you have XML documents already stored in the database and you want to parse/query these using XQL. Unfortunately, there isn't an easy way of converting between SQL format and XML (this can be implemented with some of the included Java classes, but this requires implementation work on your part). Also, you'll need to license the ASE_JAVA option to use this functionality.&lt;br /&gt;Full details are described here. &lt;br /&gt;ASE 12.0+: In 12.0+, you can also turn the contents of a table into XML format using the stored procedure sp_tab2xml, described below. This is quite a simple tool (though it uses rather advanced T-SQL programming tricks), and does not require any licensable options; yet, it is surprisingly useful.&lt;br /&gt;Lastly, Thomas Gagne's 'is' tool is basically an isql replacement that can return a result set as XML (or HTML); it works well, but you'll have to build the tool from the source code your self - YMMV...&lt;br /&gt;&lt;br /&gt;--------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;sp_tab2xml: a simple SQL-to-XML tool for Sybase ASE&lt;br /&gt;I have repeatedly received requests from ASE users who simply want to present some of their relational data in XML format, but don't want to bother with Java licenses or custom software development. Basically, many ASE users seem to need a simple way to present a result set as XML.&lt;br /&gt;&lt;br /&gt;For those requirements, I wrote a (rather straightforward) stored procedure named sp_tab2xml which presents the rows in a database table (or view) as XML documents, with tags corresponding to the column names. You can download this stored procedure here.&lt;br /&gt;&lt;br /&gt;Let's just display the contents of the table pubs3..publishers as XML: &lt;br /&gt;1&gt; use pubs3                                 &lt;br /&gt;2&gt; go                                        &lt;br /&gt;1&gt; sp_tab2xml publishers                     &lt;br /&gt;2&gt; go                                        &lt;br /&gt;&lt;?xml version="1.0"?&gt;&lt;br /&gt;&lt;resultset&gt;&lt;br /&gt;&lt;publishers&gt;&lt;br /&gt;  &lt;pub_id&gt;0736&lt;/pub_id&gt;&lt;br /&gt;  &lt;pub_name&gt;New Age Books&lt;/pub_name&gt;&lt;br /&gt;  &lt;city&gt;Boston&lt;/city&gt;&lt;br /&gt;  &lt;state&gt;MA&lt;/state&gt;&lt;br /&gt;&lt;/publishers&gt;&lt;br /&gt;&lt;br /&gt;&lt;publishers&gt;&lt;br /&gt;  &lt;pub_id&gt;0877&lt;/pub_id&gt;&lt;br /&gt;  &lt;pub_name&gt;Binnet &amp;amp; Hardley&lt;/pub_name&gt;&lt;br /&gt;  &lt;city&gt;Washington&lt;/city&gt;&lt;br /&gt;  &lt;state&gt;DC&lt;/state&gt;&lt;br /&gt;&lt;/publishers&gt;&lt;br /&gt;&lt;br /&gt;&lt;publishers&gt;&lt;br /&gt;  &lt;pub_id&gt;1389&lt;/pub_id&gt;&lt;br /&gt;  &lt;pub_name&gt;Algodata Infosystems&lt;/pub_name&gt;&lt;br /&gt;  &lt;city&gt;Berkeley&lt;/city&gt;&lt;br /&gt;  &lt;state&gt;CA&lt;/state&gt;&lt;br /&gt;&lt;/publishers&gt;&lt;br /&gt;&lt;br /&gt;&lt;/resultset&gt;&lt;br /&gt;(return status = 0)&lt;br /&gt;&lt;br /&gt;The column-list parameter can be used to include only certain columns: &lt;br /&gt;1&gt; sp_tab2xml publishers, NULL, "pub_id, city"&lt;br /&gt;2&gt; go&lt;br /&gt;&lt;?xml version="1.0"?&gt;&lt;br /&gt;&lt;resultset&gt;&lt;br /&gt;&lt;publishers&gt;&lt;br /&gt;  &lt;pub_id&gt;0736&lt;/pub_id&gt;&lt;br /&gt;  &lt;city&gt;Boston&lt;/city&gt;&lt;br /&gt;&lt;/publishers&gt;&lt;br /&gt;&lt;br /&gt;&lt;publishers&gt;&lt;br /&gt;  &lt;pub_id&gt;0877&lt;/pub_id&gt;&lt;br /&gt;  &lt;city&gt;Washington&lt;/city&gt;&lt;br /&gt;&lt;/publishers&gt;&lt;br /&gt;&lt;br /&gt;&lt;publishers&gt;&lt;br /&gt;  &lt;pub_id&gt;1389&lt;/pub_id&gt;&lt;br /&gt;  &lt;city&gt;Berkeley&lt;/city&gt;&lt;br /&gt;&lt;/publishers&gt;&lt;br /&gt;&lt;br /&gt;&lt;/resultset&gt;&lt;br /&gt;(return status = 0)&lt;br /&gt;&lt;br /&gt;Expressions are also allowed, and XML tags can be renamed: &lt;br /&gt;1&gt; sp_tab2xml publishers, NULL, &lt;br /&gt;2&gt; "Town=upper(city), Publisher=pub_id"&lt;br /&gt;3&gt; go&lt;br /&gt;&lt;?xml version="1.0"?&gt;&lt;br /&gt;&lt;resultset&gt;&lt;br /&gt;&lt;publishers&gt;&lt;br /&gt;  &lt;town&gt;BOSTON&lt;/town&gt;&lt;br /&gt;  &lt;publisher&gt;0736&lt;/publisher&gt;&lt;br /&gt;&lt;/publishers&gt;&lt;br /&gt;&lt;br /&gt;&lt;publishers&gt;&lt;br /&gt;  &lt;town&gt;WASHINGTON&lt;/town&gt;&lt;br /&gt;  &lt;publisher&gt;0877&lt;/publisher&gt;&lt;br /&gt;&lt;/publishers&gt;&lt;br /&gt;&lt;br /&gt;&lt;publishers&gt;&lt;br /&gt;  &lt;town&gt;BERKELEY&lt;/town&gt;&lt;br /&gt;  &lt;publisher&gt;1389&lt;/publisher&gt;&lt;br /&gt;&lt;/publishers&gt;&lt;br /&gt;&lt;br /&gt;&lt;/resultset&gt;&lt;br /&gt;(return status = 0)&lt;br /&gt;&lt;br /&gt;Finally, the where and order-by clause can be used to filter and order the rows: &lt;br /&gt;1&gt; sp_tab2xml publishers, NULL, NULL, &lt;br /&gt;2&gt; "where city like 'B%' order by state"&lt;br /&gt;3&gt; go&lt;br /&gt;&lt;?xml version="1.0"?&gt;&lt;br /&gt;&lt;resultset&gt;&lt;br /&gt;&lt;publishers&gt;&lt;br /&gt;  &lt;pub_id&gt;1389&lt;/pub_id&gt;&lt;br /&gt;  &lt;pub_name&gt;Algodata Infosystems&lt;/pub_name&gt;&lt;br /&gt;  &lt;city&gt;Berkeley&lt;/city&gt;&lt;br /&gt;  &lt;state&gt;CA&lt;/state&gt;&lt;br /&gt;&lt;/publishers&gt;&lt;br /&gt;&lt;br /&gt;&lt;publishers&gt;&lt;br /&gt;  &lt;pub_id&gt;0736&lt;/pub_id&gt;&lt;br /&gt;  &lt;pub_name&gt;New Age Books&lt;/pub_name&gt;&lt;br /&gt;  &lt;city&gt;Boston&lt;/city&gt;&lt;br /&gt;  &lt;state&gt;MA&lt;/state&gt;&lt;br /&gt;&lt;/publishers&gt;&lt;br /&gt;&lt;br /&gt;&lt;/resultset&gt;&lt;br /&gt;(return status = 0)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.sypron.nl/xml.html"&gt;CHECK OUT MORE OF THIS ON http://www.sypron.nl/xml.html&lt;/a&gt; &lt;/i&gt;&lt;/b&gt;&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-6042057826235301054?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/6042057826235301054/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=6042057826235301054&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/6042057826235301054'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/6042057826235301054'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/converting-sql-result-sets-to-xml-in.html' title='Converting SQL result sets to XML in Sybase ASE'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-2769184823981304389</id><published>2007-12-18T20:26:00.005-06:00</published><updated>2007-12-18T20:26:51.164-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sybase'/><title type='text'>Querying the system catalog for tables, columns and constraints</title><content type='html'>&lt;b&gt;&lt;span style="font-size:130%;"&gt;&lt;a name="Querying system catalogs"&gt;Querying the system catalog for tables, columns and constraints&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;--------------------------------------------------------------------------------&lt;br /&gt;   // show tables and their columns in their original order&lt;br /&gt;SELECT so.name, sc.name, st.name, sc.length, sc.prec, sc.scale, sc.status&lt;br /&gt;FROM dbo.sysobjects so, dbo.syscolumns sc, dbo.systypes st&lt;br /&gt;WHERE so.type IN ( 'V', 'U' )&lt;br /&gt;   AND so.id = sc.id&lt;br /&gt;   AND sc.type = st.type&lt;br /&gt;   AND st.usertype NOT IN ( 18, 25 )&lt;br /&gt;   AND so.name = "RTI_IMPORT_PROVRVU"&lt;br /&gt;ORDER BY sc.colid&lt;br /&gt;&lt;br /&gt;// show referential integrity constraints&lt;br /&gt;SELECT so.name table_name,&lt;br /&gt;      sc.name column_name ,&lt;br /&gt;      constr_obj.name constraint_name,&lt;br /&gt;      ref_obj.name referenced_table_name,&lt;br /&gt;      ref_col.name referenced_column_name&lt;br /&gt;FROM sysobjects so,&lt;br /&gt;      sysobjects constr_obj,&lt;br /&gt;      sysreferences sr,&lt;br /&gt;      sysobjects ref_obj,&lt;br /&gt;      syscolumns sc,&lt;br /&gt;      syscolumns ref_col&lt;br /&gt;WHERE constr_obj.id = sr.constrid&lt;br /&gt;   AND sr.tableid = so.id&lt;br /&gt;   AND sr.reftabid = ref_obj.id&lt;br /&gt;   AND sr.fokey1 = sc.colid&lt;br /&gt;   AND sr.tableid = sc.id&lt;br /&gt;   AND sr.refkey1 = ref_col.colid&lt;br /&gt;   AND ref_obj.id = ref_col.id&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-2769184823981304389?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/2769184823981304389/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=2769184823981304389&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/2769184823981304389'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/2769184823981304389'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/querying-system-catalog-for-tables.html' title='Querying the system catalog for tables, columns and constraints'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-3676462980168684344</id><published>2007-12-18T20:26:00.003-06:00</published><updated>2007-12-18T20:26:32.357-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sybase'/><title type='text'>How to get the nth highest salary</title><content type='html'>&lt;p&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;&lt;a name="How to get the nth highest salary"&gt;How to get the nth highest salary&lt;br /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;--------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;This SQL will find the employee with the nth highest salary from the 'employee' table defined as&lt;br /&gt;  emp_id Integer&lt;br /&gt;salary decimal(12,0)&lt;br /&gt;&lt;br /&gt;SELECT emp_id, salary&lt;br /&gt;FROM employee a&lt;br /&gt;WHERE ( SELECT COUNT( * )&lt;br /&gt;            FROM employee b&lt;br /&gt;            WHERE b.salary &gt; a.salary ) = ( n - 1 )&lt;/p&gt; &lt;p&gt;To list all the employees in the 'top - n salary bracket' use:&lt;br /&gt;&lt;br /&gt;SELECT emp_id, salary&lt;br /&gt;FROM employee a&lt;br /&gt;WHERE ( SELECT COUNT( * )&lt;br /&gt;            FROM employee b&lt;br /&gt;            WHERE b.salary &gt; a.salary ) &lt;= ( n - 1 )&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-3676462980168684344?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/3676462980168684344/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=3676462980168684344&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/3676462980168684344'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/3676462980168684344'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/how-to-get-nth-highest-salary.html' title='How to get the nth highest salary'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-8910607833352951088</id><published>2007-12-18T20:26:00.001-06:00</published><updated>2007-12-18T20:26:17.097-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sybase'/><title type='text'>How to concatenate all the values from a column and return a single row?</title><content type='html'>&lt;p&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;&lt;a name="How to concatenate all the values from a column and return a single row?"&gt;How to concatenate all the values from a column and return a single row?&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;----------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;It was possible to concatenate a series of strings to return a single column, in a sort of analogous manner to sum summing all of the numbers in a column. However, this was not a 'feature' but a bug, so if you are running an EBF that has the fix for CR 210688, this is no longer possible.&lt;br /&gt;&lt;br /&gt;(Obsolete:) Use a case statement, a la,&lt;br /&gt;&lt;br /&gt;&lt;b&gt;DECLARE @string_var varchar(255)&lt;br /&gt;SELECT @string_var = ""&lt;br /&gt;SELECT @string_var = @string_var +&lt;br /&gt;    ( CASE 1 WHEN 1 THEN char_col&lt;br /&gt;    END )&lt;br /&gt;    FROM tbl_a&lt;br /&gt;&lt;br /&gt;PRINT "%1!", @string_var&lt;br /&gt;GO&lt;/b&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-8910607833352951088?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/8910607833352951088/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=8910607833352951088&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/8910607833352951088'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/8910607833352951088'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/how-to-concatenate-all-values-from.html' title='How to concatenate all the values from a column and return a single row?'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-1295658600136244035</id><published>2007-12-18T20:25:00.005-06:00</published><updated>2007-12-18T20:25:59.451-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sybase'/><title type='text'>How to execute dynamic SQL in the server (within stored procedures and triggers)</title><content type='html'>&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;b&gt;&lt;a name="How to execute dynamic SQL in the server (within stored procedures and triggers)"&gt;How to execute dynamic SQL in the server (within stored procedures and triggers)&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;----------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;ASE System 12 solution:&lt;/p&gt; &lt;p&gt;&lt;b&gt;DECLARE @sqlstring varchar(255)&lt;br /&gt;SELECT @sqlstring = "SELECT COUNT(*) FROM master..sysobjects"&lt;br /&gt;EXEC (@sqlstring)&lt;br /&gt;GO&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;ASE 11.5 and 11.9 solution utilizing the CIS features:&lt;br /&gt;&lt;br /&gt;Firstly define your local server to be a remote server using&lt;br /&gt;&lt;b&gt;sp_addserver LOCALSRV,sql_server[,INTERFACENAME]&lt;br /&gt;GO&lt;/b&gt;&lt;/p&gt; &lt;p&gt;Enable CIS&lt;br /&gt;&lt;b&gt;sp_configure "enable cis",1&lt;br /&gt;GO &lt;/b&gt;&lt;/p&gt; &lt;p&gt;Finally, use sp_remotesql, sending the sql to the server defined in point 1.&lt;br /&gt;&lt;b&gt;DECLARE @sqlstring varchar(255)&lt;br /&gt;SELECT @sqlstring = "SELECT COUNT (*) FROM master..sysobjects"&lt;br /&gt;sp_remotesql LOCALSRV,@sqlstring&lt;br /&gt;GO&lt;/b&gt;&lt;/p&gt; Remember to ensure that all of the databases referred to in the SQL string are fully qualified since the call to sp_remotesql places you back in your default database.&lt;br /&gt;&lt;br /&gt;ASE 10 solution (undocumented feature using stored procedures):&lt;br /&gt;&lt;br /&gt;&lt;b&gt;DECLARE @sqlstring varchar(255)&lt;br /&gt;SELECT @sqlstring = "sp_who"&lt;br /&gt;EXEC @sqlstring&lt;br /&gt;GO&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-1295658600136244035?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/1295658600136244035/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=1295658600136244035&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/1295658600136244035'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/1295658600136244035'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/how-to-execute-dynamic-sql-in-server.html' title='How to execute dynamic SQL in the server (within stored procedures and triggers)'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-5448982301942606032</id><published>2007-12-18T20:25:00.003-06:00</published><updated>2007-12-18T20:25:43.789-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sybase'/><title type='text'>How to avoid divide by zero</title><content type='html'>&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;b&gt;&lt;a name="How to avoid divide by zero"&gt;How to avoid divide by zero&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;----------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SELECT CASE WHEN field2 = 0 THEN 0 ELSE field1 / field2&lt;br /&gt;FROM table&lt;/b&gt;&lt;/p&gt; &lt;p&gt;or&lt;/p&gt; &lt;p&gt;&lt;b&gt;SELECT field1 / ( field2 * CONVERT( int, SUBSTRING( '1', 1, ABS( SIGN( field2 ) ) ) ) )&lt;br /&gt;FROM table&lt;/b&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-5448982301942606032?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/5448982301942606032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=5448982301942606032&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/5448982301942606032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/5448982301942606032'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/how-to-avoid-divide-by-zero.html' title='How to avoid divide by zero'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-3257111121691332678</id><published>2007-12-18T20:25:00.001-06:00</published><updated>2007-12-18T20:25:26.738-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sybase'/><title type='text'>How to implement if-then-else comparing strings in a select clause</title><content type='html'>&lt;b&gt;&lt;span style="font-size:130%;"&gt;&lt;a name="How to implement if-then-else comparing strings in a select clause"&gt;How to implement if-then-else comparing strings in a select clause&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;----------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SELECT ISNULL( SUBSTRING( 'Petit', CHARINDEX( 'SMALL', PRODUCT_SIZE ), 255 ), 'Grand' )&lt;br /&gt;FROM PRODUCTS&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-3257111121691332678?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/3257111121691332678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=3257111121691332678&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/3257111121691332678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/3257111121691332678'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/how-to-implement-if-then-else-comparing.html' title='How to implement if-then-else comparing strings in a select clause'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-780461522636091483</id><published>2007-12-18T20:24:00.000-06:00</published><updated>2007-12-18T20:25:03.101-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sybase'/><title type='text'>How to emulate the Oracle decode function/crosstab with boolean logic</title><content type='html'>&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;b&gt;&lt;a name="How to emulate the Oracle decode function/crosstab with boolean logic"&gt;How to emulate the Oracle decode function/crosstab with boolean logic&lt;/a&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;----------------------------------------------------------------------------------&lt;br /&gt;&lt;/p&gt; &lt;p&gt;From the Rozenshteins book, "Advanced SQL", there is the concept of characteristic functions: the delta function. For a Boolean expression such as A = B is written delta[A = B]. Its definition is that delta[A = B] = 1 whenever A = B is true and delta[A = B] = 0 otherwise. For &lt;b&gt;delta[ au_ord = 1 ]&lt;/b&gt; , the translation is &lt;b&gt;( 1 - abs( sign( au_ord - 1 ) ) )&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;If you want to test a field to see if it is equal to a value, say 100, use the following code:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SELECT ( 1 - ABS( SIGN( ISNULL( 100 - &lt;field&gt;, 1 ) ) ) )&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The innermost function will return 1 when the field is null, a positive value if the field &lt;&gt; 100 and will return 0 if the field = 100. This example is for Sybase or Microsoft SQL server, but other servers should support most of these functions or the COALESCE() function, which is the ANSI equivalent to ISNULL.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The SIGN() function returns zero for a zero value, -1 for a negative value, 1 for a positive value The ABS() function returns zero for a zero value, and &gt; 1 for any non-zero value. In this case it will return 0 or 1 since the argument is the function SIGN(), thus acting as a binary switch.&lt;br /&gt;&lt;br /&gt;Put it all together and you get '0' if the value match, and '1' if they don't. This is not that useful, so we subtract this return value from '1' to invert it, giving us a TRUE value of '1' and a false value of '0'. These return values can then be multiplied by the value of another column, or used within the parameters of another function like SUBSTRING() to return a conditional text value.&lt;br /&gt;&lt;br /&gt;This is a neat way to use boolean logic to perform cross-tab or rotation queries easily, and very efficiently. Using the aggregate 'Group By' clause in a query and the ISNULL(), SIGN(), ABS(), SUBSTRING() and CHARINDEX() functions, you can create queries and views to perform all kinds of summarizations but this technique does not produce easily understood SQL statements.&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/8287829162475847446-780461522636091483?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/780461522636091483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=780461522636091483&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/780461522636091483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/780461522636091483'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/how-to-emulate-oracle-decode.html' title='How to emulate the Oracle decode function/crosstab with boolean logic'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8287829162475847446.post-7380903637587514232</id><published>2007-12-18T20:18:00.000-06:00</published><updated>2007-12-18T20:24:40.164-06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sybase'/><title type='text'>How to implement if-then-else or emulate the Oracle decode function/crosstab (ASE 11.5 +)</title><content type='html'>&lt;p&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;&lt;a name="How to implement if-then-else or emulate the Oracle decode function/crosstab (ASE 11.5 +)"&gt; How to implement if-then-else or emulate the Oracle decode function/crosstab (ASE 11.5 +)&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;----------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;If you are using ASE version 11.5 or later, the simplest way to implement if-then-else or implement the Oracle decode is with the CASE statement. &lt;/p&gt; &lt;p&gt;&lt;b&gt;SELECT STUDENT_ID,&lt;br /&gt;    (CASE WHEN COURSE_ID = 101 THEN 1 ELSE 0 END) AS COURSE_101,&lt;br /&gt;    (CASE WHEN COURSE_ID = 105 THEN 1 ELSE 0 END) AS COURSE_105,&lt;br /&gt;    (CASE WHEN COURSE_ID = 201 THEN 1 ELSE 0 END) AS COURSE_201,&lt;br /&gt;    (CASE WHEN COURSE_ID = 210 THEN 1 ELSE 0 END) AS COURSE_210,&lt;br /&gt;    (CASE WHEN COURSE_ID = 300 THEN 1 ELSE 0 END) AS COURSE_300&lt;br /&gt;GROUP BY STUDENT_ID&lt;br /&gt;ORDER BY STUDENT_ID&lt;/b&gt;&lt;/p&gt; &lt;b&gt;SELECT&lt;br /&gt;    CASE WHEN PRODUCT_SIZE = 'SMALL' THEN 'Petit'&lt;br /&gt;    ELSE 'Grand'&lt;br /&gt;FROM PRODUCTS&lt;/b&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8287829162475847446-7380903637587514232?l=ittoolshed.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ittoolshed.blogspot.com/feeds/7380903637587514232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8287829162475847446&amp;postID=7380903637587514232&amp;isPopup=true' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/7380903637587514232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8287829162475847446/posts/default/7380903637587514232'/><link rel='alternate' type='text/html' href='http://ittoolshed.blogspot.com/2007/12/how-to-implement-if-then-else-or.html' title='How to implement if-then-else or emulate the Oracle decode function/crosstab (ASE 11.5 +)'/><author><name>PBR</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='22' height='32' src='http://img.photobucket.com/albums/0903/fotos/OculosEscuros3x4.jpg'/></author><thr:total>0</thr:total></entry></feed>
