September 2005 Entries

Zune Desktop theme for Windows XP

UPDATE: September 29, 2008
This post is relatively old and at that time, this was the only theme available.  Currently there is a Zune theme for Windows XP which is pretty cool and gives the Vista Look n Feel. 
I would recommend not going for any third party "Vista look for XP" since they consume a lot of memory resources as well as result in leakages / spyware.
The same can be downloaded from here 
Ever had a chance to look at the Windows Vista ("Longhorn") Screens? Waiting to explore the rich graphics based on Windows Presentation Foundation ("Avalon")?

For those who are itching their hands to have the new, fresh UI look for your Desktops, there is already a similar theme available for your Windows XP.

It is known as "Energy Blue" theme and it gives a fresh new look for your Windows XP, quite similar to the rich graphical interface to be shipped with Windows Vista.

The Energy Blue theme can be downloaded for free from

After downloading and installing the same, change your Desktop Themes Settings to "Energy Blue" to get the fresh new look.

This would provide your desktop a fresh look for some time until Vista ships.

Cheers !!!

MVP Global Summit - Now Happening !!!

The Microsoft Most Valulable Professionals Summit (MVP Summit) for the year 2005 is happening now !!!

MVP Summit is organized every year to provide an opportunity for MVPs to interact with Microsoft Product Groups, High Officials and other top notch people (including Steve Ballmer). Its a great opportunity for sharing and gaining knowledge on Microsoft Products. Its now happening at Redmond, Washington at the corporate headquarters of Microsoft.

The Summit would be for 4 days providing ample opportunity for MVPs and Microsoft Product Groups to interact and gain knowledge, provide feedback and get information on upcoming technologies / products.

Being an MVP, I feel very sad for not being able to attend the Summit (This is the second one I am missing. Earlier I also missed the Asia MVP Summit, Singapore).

Hope I could attend the next year Summit.

For the benefit of people who aren't aware of the MVP Program, please check
Microsoft Most Valuable Professional

Its a great recognization for Inspired People who are Inspiring the Communities. By the way, that is the slogan for MVP Program :)

Cheers !!!

You may receive the error "This document already has a DocumentElement node." - Part IV

This article is in continuation with Part I, Part II & Part III of the series related to solving the error "This document already has a DocumentElement node." which arises when we try to use XmlReader or an XmlDocument to load the XML Data returned by the FOR XML SQL Query.

The FOR XML EXPLICIT is one of the toughest techniques in returning XML Data from SQL Server using FOR XML. But it also has the greatest flexibility in controlling the XML Format that is being returned contrary to the XML Fragment format that gets returned with FOR XML RAW / FOR XML AUTO queries.

The EXPLICIT modes depends on the concept of Universal Table and manual creation of the XML Structure such that it is returned as such and not simply as a record set.

An introductory article on using FOR XML EXPLICIT is available at

A step-by-step detailed article on returning a hierarchial parent-tree relationship XML from SQL Server is available at
Windows IT Pro - XML Trees - Step by Step

I felt that the above articles cover the indepth of the subject matter and hence didnt go into the explanation of the same over here.

This ends the series of articles on working with XML Fragment data returned by FOR XML Queries and utilizing them in your applications.

Cheers and Happy Programming !!!

You may receive the error "This document already has a DocumentElement node." - Part III

This article is in continuation with Part I and Part II.

Part II, we examined how we can utilize the DataSet's intelligence to handle XML Format to overcome the "Document Element" issue while reading XML Data from SQL Server using FOR XML queries.

We will examine a much more efficient way of handling SQL XML using the SQL XML Managed classes provided with the Microsoft SQL XML Managed Provider (Available for free download from Microsoft).

Microsoft SQL XML introduces powerful set of Properties/Methods to manipulate XML Data from SQL Server FOR XML Result Sets. It leverages the powerful XML Support provided with SQL Server 2000 and provides easy accessible methods for developers from .NET coding perspective to accomplish tasks easier.

We will examine the following sample code which does the same as what we did with DataSet.

using Microsoft.Data.SqlXml;

SqlXmlCommand comm = new SqlXmlCommand("Connection String");
XmlDocument xDoc = new XmlDocument();
XmlReader xr = null;
comm.CommandType = SqlXmlCommandType.Sql;
comm.CommandText = "select * from customers for xml auto";
comm.OutputEncoding = "UTF-8";
comm.RootTag = "Customers";
xr = comm.ExecuteXmlReader();
catch(Exception ex)

While the above code accomplishes the same result as we achieved from the DataSet (as explained in Part I), note that we have a great control in the format of the XML Document.

We will examine the changes to the code line by line:-

SqlXmlCommand object is used to create an SQLXMLCommand. It requires that the Connection String provided has the DataSource specified even while working with SQLClient unlike the traditional connection string where you dont need to mention the provider if accessing SQL Server Database.

The CommandType property specifies whether it is a SQL Query or an XPATH Expression, XML Template etc.,

OutputEncoding specifies the encoding format.

The most important property is the RootTag where we specify the Root Node as "Customers". This gives us the flexibility to specify the ROOT Node for the XML Fragment returned by the FOR XML Query. This gives us the full control over the XML Document format and hence provides better way for manipulating/saving XML Data returned by FOR XML SQL Queries.

The Microsoft SQL XML Managed Provider DLL can be downloaded from
Microsoft Download Center for free.

We have to import the Microsoft.Data.SqlXml Reference after downloading the same from Microsoft Download Center.

More information on SQL XML can be found at

Read Part IV of the series.

Cheers and Happy Programming !!!

You may receive the error "This document already has a DocumentElement node." - Part II

In continuation to Part I of this article, we will examine how we can load the XML Fragment returned by the SQL FOR XML query, into a DataSet, to form a Well Formed XML Document.

SqlConnection objCon = new SqlConnection("Connection String");
SqlCommand objCmd = new SqlCommand("select * from customers for xml auto", objCon);
XmlReader xr = null;
XmlDocument xDoc = new XmlDocument();
DataSet ds = new DataSet();
xr = objCmd.ExecuteXmlReader();
catch(Exception ex)


As we can see the above code uses a DataSet to load the XML Fragment returned by the FOR XML Select query. The DataSet object is intelligent enough to append a ROOT Node to all XML Data that is being read into/written by it and hence the error "This document already has a DocumentElement node." can be avoided.

We will examine the other approaches in the next articles.

Part III, Part IV of the series.

Cheers and Happy Programming !!!

You may receive the error "This document already has a DocumentElement node." while trying to read XML Data retrieved using the FOR XML clause


You may receive the error "This document already has a DocumentElement node." while trying to read XML Data retrieved using the FOR XML clause.

SQL Server 2000's FOR XML Clause provides great support in querying SQL Server Data and retrieving it in the form of XML. In other words, you can get an XML representation of the Result Set using the FOR XML Clause.

So, if a select statement of select * from customers retrieves results in a sequential way, select * from customers FOR XML AUTO will retrieve the same in a XML Format.

There are different methods to retrieve XML representation of Data using SQL Server 2000's FOR XML clause which is beyond the scope of this article.

However, FOR XML doesn't actually return an XML document; instead, it returns an XML fragmant, with no XML declaration or root element. This is a problem if you want to feed this XML to classes that expect actual XML.

So, when we try to use XmlReader or an XmlDocument to load the XML Data returned by the FOR XML, it won't contain the Root element and hence would return the error, "This document already has a DocumentElement node."

To resolve this issue, we can adopt either of the following ways:-

1. Using a DataSet to read the results and then use XmlDataDocument or the WriteXml() method of DataSet to save the XML File

2. Using the SQL XML Managed Classes by downloading the Microsoft SQL XML Managed Provider (Available for free download from Microsoft)

3. Using the FOR XML EXPLICIT mode of SQL Server, where we can have total control over the format in which the XML is returned.

We will examine each of these methods in the forthcoming articles.

The articles are now up !!!

Part II, Part III, Part IV of the series.

Cheers and Happy Programming !!!

Performing a Case In-sensitive search in an XML Document

XML, is one of the greatest standards that have been developed and adopted over the recent years for data storing and retrieving. XML Documents can store as much information as required and yet consume very less disk space due to them being flat files. XML has provided a great means of replacement to some extent for Databases.

However XML has some restrictions (rather a good one) in it.

XML is case sensitive. Man, MAN, man & mAn are all different when it comes to XML.

XML tags need to be supplemented with end tags for every start tag. So a <Customer> tag definitely needs a </Customer> tag to mark its end.

Security, Scalability and Maintainability are certain issues which still need to be looked into.

There are a variety of XML Parsers that have been built and in use over the years and many standards such as the XPATH, XQUERY have been defined for querying XML Documents just like one would query a Database Table.

.NET has provided a lot of methods / APIs to work with XML Documents and the fullest support for querying / displaying XML Data is actually one of the major features in the advantage of .NET over its precedessors.

XPATH is fully supported in .NET, which is a W3C accepted standard for querying XML Documents. You can implement a Search through an XML Document using XPATH Expression and retrieve/modify the values in the XML Document.

However, since Xml is case sensitive, a search for "Whidbey", "WHIDBEY", "wHiDBey" will not produce the same results. In fact, the words have to be exactly matching for the XPATH Expression to identify the node.

If we would like to implement a case insensitive search, then we need to modify our XPATH Expression a little bit using the translate method. We will see a sample XPATH Expression.

Let us consider the following Books.xml

<?xml version="1.0" encoding="ISO-8859-1"?>

<book category="Cooking">
<title lang="en">Everyday Italian</title>
<author>Giada De Laurentiis</author>

<book category="xml">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>

<book category="CHILDREN">
<title lang="en">Harry Potter</title>
<author>J K. Rowling</author>

<book category="XML">
<title lang="en">XQuery Kick Start</title>
<author>James McGovern</author>
<author>Per Bothner</author>
<author>Kurt Cagle</author>
<author>James Linn</author>
<author>Vaidyanathan Nagarajan</author>

<book category="xMl">
<title lang="en">Learning XML</title>
<author>Erik T. Ray</author>

If in the above XML Document, we would like to find out all books that fall under the category "XML" and we dont worry about the case in which the category has been mentioned in the file (i.e. xml, XML, xMl etc.,), we can use the following XPATH Expression which retrieves the set of nodes irrespective of the case of the category "XML".

string searchtext = "Xml";

/bookstore/book[translate(@category, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = '" + searchtext.ToLower() + "']

As it is evident from the above XPATH Expression, we are assigning the search keyword "xml" to the variable searchtext and in the XPATH, we are
converting it to all lower case using the ToLower() method of the string class and building the xpath expression. Same way, in the XPATH, we are using the translate function to convert the @category values to all lower so that it searches through the categories irrespective of whether the search keyword is "xml", "XML" or "xML".

Upon executing the above XPATH Expression using appropriate XmlDocument or XpathDocument, the results which fall under the category "XML" will be retrieved irrespective of whether it is "xml", "XML" or "Xml".

Thus, we can implement a case-insensitive search through XML Documents using the XPATH Expression's translate function.

Cheers and Happy XPathing !!!

Visual Studio 2005 ! The Count Down Begins !! 60 Days to go !!!

Hope by now everyone is aware of the next major release of Microsoft, the Visual Studio 2005 (They have eliminated the term .NET which was there in prior versions i.e Visual Studio .NET 2003, Visual Studio .NET 2002).

The official release date is November 7, 2005 launch of Visual Studio 2005, one of the most significant releases in the history of the Developer Division.

Visual Studio 2005 leverages on the next version of .NET Framework - 2.0. There has been a lot of Beta Releases, CTPs from which Microsoft got huge amount of feedbacks / suggestions which they have listed to and implemented in the subsequent builds / releases. The final release which is planned to be done as a grand release across different locations will be on November 7, 2005, the big day to watch out !!!

Visual Studio 2005 drastically removes most of the plumbing work developers need to do for developing web / windows ~ applications / services and improves developer productivity to a great extent.

Code Refactoring, Auto Correction of Method Changes, No building of DLL for each and every change, ability to build individual files, Intellisense in Code Behind / Code Inline are a few great points to name out when Visual Studio 2005 comes into mind.

One thing which was worrying for me was the inability to exclude files from project while building, which in current Visual Studio.NET 2003 is a very useful feature. A lot of feedback has gone about this and hope it will be a part of the final release.

Along with Visual Studio 2005 there are exciting range of other products lined up for release..

Visual Studio 2005 Team Foundation Server (TFS)
Visual Studio Team System (VSTS)

SQL Server 2005 (Yukon) which is the buzz among SQL Experts of late (rather for the past 2 years).

More information and resources can be found at
Visual Studio 2005 Beta Home

I am excited about the new releases and the new set of development standards being introduced with Visual Studio 2005 and I hope you would be as well.

Cheers to Visual Studio 2005 !!!

Tech Fest 2005 - Microsoft User Group, Hyderabad... Its Festival Time for Techies Now !!!

Microsoft User Group, Hyderabad popularly called as MUGH (Formerly DNUG - DotNet User Group, Hyderabad) proudly presents Tech Fest 2005 !!!

After the huge success of DevCon 2005, MUGH is back again with Tech Fest an event covering contests on both the new releases from Microsoft - Whidbey & Yukon.

The two broad categories are as follows:

Code Warriors 2005

Code Warriors 2005 is a developer challenge, that enables software developers all over to develop and exhibit their applications using Microsoft .NET Technology. Developers are free to adopt some of the best practices in software development or develop their own way, software applications and submit to MUGH for evaluations.


SQLWIZ 2005 is a Technical White paper contest conducted by MUGH to identify and reward the best SQL Brains of SQLCON, Hyderabad. This is an opportunity for developers to brainstorm on architecting, designing and database tuning; and showcase their skills to the technical community by presenting their white papers.

Some of the key sponsors are GotDotNet Community, Microsoft, Satyam, Infotech etc.,

Prizes, would there be fun without them? Just an illustration of the exciting prizes:-

1. Cool GotDotNet T-Shirt
2. Early Bird Prizes
3. Signed Copies of .NET Books
4. Grand Prizes for finals.

For more information please visit
Microsoft User Group, Hyderabad

Cheers & Happy Tech Fest 2005