<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://dotnetslackers.com/Community/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><title type="html">Bashar Kokash&amp;#39; Blog</title><subtitle type="html">.Net Framework, windows and web development.</subtitle><id>http://dotnetslackers.com/Community/blogs/basharkokash/atom.aspx</id><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/default.aspx" /><link rel="self" type="application/atom+xml" href="http://dotnetslackers.com/Community/blogs/basharkokash/atom.aspx" /><generator uri="http://communityserver.org" version="3.1.30415.43">Community Server</generator><updated>2008-05-13T13:38:00Z</updated><entry><title>Hotfix for C#</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/11/06/hotfix-for-c.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/11/06/hotfix-for-c.aspx</id><published>2008-11-06T12:01:00Z</published><updated>2008-11-06T12:01:00Z</updated><content type="html">&lt;p&gt;After istalling .NET SP1, we all may encountered false C# compilation errors appear in the &lt;b&gt;Error List&lt;/b&gt;&lt;em&gt;&lt;/em&gt;&amp;nbsp; for ASP.NET Website projects.&lt;/p&gt;
&lt;p&gt;Yes, that&amp;#39;s because SP1 adds a new feature &amp;quot;live reporting of compilation errors&amp;quot; but unfortunately caused this bug, to solve this problem, I had to turn this feature off and loose its effects, but recently Microsoft has released a new hotfix that will solve this problem, you can download it &lt;b&gt;&lt;a target="_blank" href="http://code.msdn.microsoft.com/kb957259"&gt;here&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=29809" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author></entry><entry><title>Thanks to chkdsk command...</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/09/25/thanks-to-chkdsk-command.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/09/25/thanks-to-chkdsk-command.aspx</id><published>2008-09-25T06:15:00Z</published><updated>2008-09-25T06:15:00Z</updated><content type="html">&lt;p&gt;&lt;br /&gt;
I had accidentally unplugged the power of my PC at office while it&amp;#39;s
running.
At first, I thanked GOD that I wasn&amp;#39;t in a middle of a long programming
task. I plugged the power again and started the PC, unfortunately the
windows couldn&amp;#39;t start at all, even on safe mode. After a while I
decided to use the Windows XP CD, but I don&amp;#39;t know why the setup
couldn&amp;#39;t read the file system on C drive, and suggested to format this
drive even when I tried to install a new Windows version on D drive. Of
course I will never format a drive while I don&amp;#39;t have a recent backup
of the data.&lt;br /&gt;
&lt;br /&gt;
As a final solution I selected the Repair option using the Console during the
Windows XP setup, and a DOS cmd was lunched, I couldn&amp;#39;t access c drive
and I get a file corrupted message, but when I tried CHKDSK command to
check C for errors I was surprised that it could be able to start and
check the disk for errors.&lt;br /&gt;
&lt;br /&gt;
When restarting then everything was alright. Thanks chkdsk you save my PC.&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=29146" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author></entry><entry><title> Microsoft Visual Studio 2008 Service Pack 1</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/08/12/microsoft-visual-studio-2008-service-pack-1.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/08/12/microsoft-visual-studio-2008-service-pack-1.aspx</id><published>2008-08-12T08:20:00Z</published><updated>2008-08-12T08:20:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;Microsoft released&amp;nbsp;the Visual Studio 2008&amp;nbsp;Service Pack 1 that includes numerous bug fixes, as well as updates.&lt;a target="_blank" href="http://blogs.msdn.com/webdevtools/default.aspx" class="null"&gt;More Details&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can download the update&amp;nbsp;&lt;a target="_blank" href="http://msdn.microsoft.com/en-us/vstudio/cc533448.aspx" class="null"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=28365" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term="Visual Studio 2008" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/Visual+Studio+2008/default.aspx" /></entry><entry><title>LINQPAD: Greate tool for LINQ</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/08/11/linqpad-greate-tool-for-linq.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/08/11/linqpad-greate-tool-for-linq.aspx</id><published>2008-08-11T11:11:00Z</published><updated>2008-08-11T11:11:00Z</updated><content type="html">&lt;p&gt;This is an&amp;nbsp;amaizing free tool&amp;nbsp;for LINQ.&lt;/p&gt;
&lt;p&gt;LINQPad lets you interactively query SQL databases in a &lt;i&gt;modern query language&lt;/i&gt;: LINQ&lt;/p&gt;
&lt;p&gt;To&amp;nbsp;download LINQPAD, please visit: &lt;a href="http://www.linqpad.net/"&gt;http://www.linqpad.net/&lt;/a&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=28348" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term="LINQ" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/LINQ/default.aspx" /></entry><entry><title>Using Unit Test in Visual Studio 2008 Professional</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/07/20/using-unit-test-in-visual-studio-2008-professional.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/07/20/using-unit-test-in-visual-studio-2008-professional.aspx</id><published>2008-07-20T12:50:00Z</published><updated>2008-07-20T12:50:00Z</updated><content type="html">&lt;p&gt;I would like to share you my article on &lt;a target="_blank" href="http://www.defaultdotaspx.com" class="null"&gt;Defaultdotaspx.com&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It describes the basics of unit testing then a few steps about how to use unit tests in Visual studio 2008.&lt;/p&gt;
&lt;p&gt;I hope this article helps&amp;nbsp;to understand the basics so more complex scenarios would be easier.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a target="_blank" href="http://www.defaultdotaspx.com/Articles/07202008/Using-Unit-Test-in-Visual-Studio-2008.aspx" class="null"&gt;Using Unit Test in Visual Studio 2008 Professional&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=27927" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term="Visual Studio 2008" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/Visual+Studio+2008/default.aspx" /><category term="Unit Test" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/Unit+Test/default.aspx" /><category term="article" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/article/default.aspx" /></entry><entry><title>Class browser</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/07/13/class-browser.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/07/13/class-browser.aspx</id><published>2008-07-13T12:25:00Z</published><updated>2008-07-13T12:25:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;My brother Bassl started to blog about windows clients applications, today he posted a new class browser tool, I think it&amp;#39;s great and useful, but still need some more debugging since it&amp;#39;s the first version, anyway you can browse your classes &lt;a target="_blank" href="http://blogs.windowsclient.net/basslk/archive/2008/07/13/classbrowser.aspx" class="null"&gt;here&lt;/a&gt;, test it and give him your feedback.&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=27760" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term="Windows Applications" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/Windows+Applications/default.aspx" /></entry><entry><title>Tools to block and eradicate SQL injection</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/25/tools-to-block-and-eradicate-sql-injection.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/25/tools-to-block-and-eradicate-sql-injection.aspx</id><published>2008-06-25T06:31:00Z</published><updated>2008-06-25T06:31:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;SQL injection is one of the most common attacks on websites, so Microsoft&amp;nbsp; has released &lt;a target="_blank" href="http://www.microsoft.com/technet/security/advisory/951306.mspx" class="null"&gt;&lt;span style="color:#003399;"&gt;an advisory&lt;/span&gt;&lt;/a&gt; for the&lt;b&gt;&lt;i&gt; &lt;/i&gt;&lt;/b&gt;recent SQL Injection attacks&lt;/p&gt;
&lt;p&gt;Joe Stanger has a great &lt;a target="_blank" href="http://www.misfitgeek.com/Tools+To+Block+And+Eradicate+SQL+Injection.aspx" class="null"&gt;post&lt;/a&gt; describing those tools for It professionals as well as developers.&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=27404" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term="SQL injection" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/SQL+injection/default.aspx" /><category term="Tools" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/Tools/default.aspx" /></entry><entry><title>SQL CLR Limitations in SQL Server 2005</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/25/sql-clr-limitations-in-sql-server-2005.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/25/sql-clr-limitations-in-sql-server-2005.aspx</id><published>2008-06-25T06:03:00Z</published><updated>2008-06-25T06:03:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;Referring to my previous post about &lt;a target="_blank" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/07/how-to-implement-your-own-aggregate-function-in-sqlclr-sql-server-2005.aspx" class="null"&gt;How to implement user defined aggregates in SQL Server 2005&lt;/a&gt;, I had a couple of emails about some problems when data size exceeds the 8KB which was a limit in SQL Server 2005.&lt;/p&gt;
&lt;p&gt;I forgot to mention this point in my previous post, also I have to say that this problem or limitation is not a limitation any more in SQL Server 2008.&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=27403" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term="SQL SERVER 2005" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/SQL+SERVER+2005/default.aspx" /><category term="SQL CLR" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/SQL+CLR/default.aspx" /><category term="SQL SERVER 2008" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/SQL+SERVER+2008/default.aspx" /><category term="UDA" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/UDA/default.aspx" /></entry><entry><title>Measuring SQLCR Performance using SQL Server Profiler</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/09/measuring-sqlcr-performance-using-sql-server-profiler.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/09/measuring-sqlcr-performance-using-sql-server-profiler.aspx</id><published>2008-06-09T08:38:00Z</published><updated>2008-06-09T08:38:00Z</updated><content type="html">&lt;p&gt;Recently, I&amp;#39;ve been doing a lot of invoking .NET Assemblies within SQL Server 2005, I bloged an overview of SQLCLR &lt;a target="_self" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/04/sql-clr-overview.aspx" class="null"&gt;here&lt;/a&gt;, also I posted about how to implement aggregation function in C# &lt;a target="_self" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/07/how-to-implement-your-own-aggregate-function-in-sqlclr-sql-server-2005.aspx" class="null"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Actually invoking .NET code has many advantages but at the same time we should be aware of the performance, that&amp;#39;s why I tested my CountNulls Aggregation function - created in a previous &lt;a target="_self" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/07/how-to-implement-your-own-aggregate-function-in-sqlclr-sql-server-2005.aspx" class="null"&gt;post&lt;/a&gt; - with the SQL Server Profiler tool.&lt;/p&gt;
&lt;p&gt;I tested the function on the Person.Contact table that is in the AdventureWorks Database which contains 19972 records.&lt;/p&gt;
&lt;p&gt;SELECT dbo.CountNulls(MiddleName)&amp;nbsp; from Person.Contact&lt;/p&gt;
&lt;p&gt;The duration time was ranging between 93 and 154 milliseconds&lt;/p&gt;
&lt;p&gt;While the following T-SQL&amp;nbsp;statement&amp;nbsp;gives the same results but&amp;nbsp;with duration time&amp;nbsp;ranges from 1 to 3 milliseconds maximum.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Select count(*) as from Person.Contact where MiddleName is null&lt;/p&gt;
&lt;p&gt;As a result we should not move to use SQLCLR unless there is a clear sign, that means to implement a function in .NET we have to give T-SQL a chance and only when T-SQL fails we then use .NET Assemblies.&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=27136" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term="C#" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/C_2300_/default.aspx" /><category term="SQL SERVER 2005" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/SQL+SERVER+2005/default.aspx" /><category term="SQL CLR" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/SQL+CLR/default.aspx" /><category term="Performance" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/Performance/default.aspx" /><category term="T-SQL" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/T-SQL/default.aspx" /></entry><entry><title>How to implement your own aggregate function in SQLCLR, SQL Server 2005</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/07/how-to-implement-your-own-aggregate-function-in-sqlclr-sql-server-2005.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/07/how-to-implement-your-own-aggregate-function-in-sqlclr-sql-server-2005.aspx</id><published>2008-06-07T08:15:00Z</published><updated>2008-06-07T08:15:00Z</updated><content type="html">&lt;p&gt;I posted earlier&amp;nbsp;an &lt;a target="_self" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/04/sql-clr-overview.aspx"&gt;overview&lt;/a&gt; about the SQLCLR component of the SQL Server 2005, and showed how to implement a simple user-defined function using Visual Studio 2008 and C#, this post will show the importance of .NET&amp;nbsp;Framework to SQLCLR by adding more&amp;nbsp;functionality to SQL Server 2005.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Using T-SQL we can create user-defined function, stored procedures and triggers, but we can&amp;#39;t do is to add a user-defined aggregate function. An aggregate function&amp;nbsp;operates against a collection of values, but returns only&amp;nbsp;a single value, for example the sum(), avg(), and count() functions. Each of those functions works on all the&amp;nbsp;rows in a specified column, but only returns one value like the sum , the average, or the number of rows.&lt;/p&gt;
&lt;p&gt;But what if I needed to create my own aggregate function that does a special job, using T-SQL there is no direct way, but we can use cursors and loop for each row which may result complex code with a bad performance, fortunately SQLCLR provides us the ability to implement user-defined aggregate.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Implementation:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The following will show how to implement a simple aggregate function using C# and Visual Studio 2008.&lt;/p&gt;
&lt;p&gt;The aggregate function that was chosen for this example is&amp;nbsp;a simple COUNTNULL aggregate function that returns the number of NULL&amp;nbsp;rows in a specified column, of course you can do it easily in T-SQL but this is just a simple example.&lt;/p&gt;
&lt;p&gt;Inside&amp;nbsp;your Database project in Visual Studio add an new item and select Aggregate, and a new class is added to the project, actually it&amp;#39;s a structure.&lt;/p&gt;
&lt;p&gt;Each aggregate function needs to be in a separate struct, notice this struct is marked as [Serializable] and [SqlUserDefinedAggregate(Format.Native)].&lt;/p&gt;
&lt;p&gt;SQL Server 2005 needs to store effective representation of the aggregate on disk so the aggregate should be Serializable and SqlUserDefinedAggregate attribute indicates that this class or struct is a user-defined aggregate, and the property Format.Native tells the .NET Framework to handle the serialization process using a simple algorithm and it works only with value types that&amp;#39;s why the aggregate is defined as a struct.&lt;/p&gt;
&lt;p&gt;You can also specify the property name in the SqlUserDefinedAggregate attribute to the name of you Aggregate function &amp;quot;The name that is called in SQL Server 2005&amp;quot;.&lt;br /&gt;[SqlUserDefinedAggregate (Format.Native,Name = &amp;quot;CountNulls&amp;quot;)] &lt;/p&gt;
&lt;p&gt;Now, inside the class we have to implement four methods in order the aggregate to work, there are init, accumulate, merge and terminate.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;b&gt;Init()&lt;/b&gt;&lt;/em&gt; method is used in order to initialize any needed resources or variables and is called only once when the aggregate is called.&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;b&gt;Accumulate()&lt;/b&gt;&lt;/em&gt; method is the actual implementation of the aggregate function and is called once for each row. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;i&gt;Merge() &lt;/i&gt;&lt;/strong&gt;method is used because sometimes if the the column to aggregate contains a large number of data&amp;nbsp;the SQLCLR may split those rows into groups and aggregate each group individually and then merge the results of those group again, then the Merge() method is called.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;i&gt;Terminate() &lt;/i&gt;&lt;/strong&gt;method is used free any used resources and to return the result of this aggregate function.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Below is the code for the CountNulls aggregate function with some comments:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Data.SqlClient;&lt;br /&gt;using System.Data.SqlTypes;&lt;br /&gt;using Microsoft.SqlServer.Server;&lt;br /&gt;using Microsoft.SqlServer.Server;&lt;br /&gt;[Serializable]&lt;br /&gt;[SqlUserDefinedAggregate(Format.Native,Name = &amp;quot;CountNulls&amp;quot;)]&lt;br /&gt;public struct CountNulls&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private int Counter;&amp;nbsp; // field to count the not null rows&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Init()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Counter = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // initialization&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Accumulate(object Value)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (Value == DBNull.Value)&amp;nbsp; // count just the rows that are not equal to NULL&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Counter++;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void Merge(CountNulls Group)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.Counter += Group.Counter; // when merge is needed the&amp;nbsp;counter of other groups should&amp;nbsp;be added&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public SqlString Terminate()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new SqlString(Counter.ToString()); //returning the results&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;After you compile this class you have to deploy it in order to make available to be used inside SQL Server 2005&lt;/p&gt;
&lt;p&gt;Finally go to SQL Server Management Studio and use your aggregate function as follows:&lt;/p&gt;
&lt;p&gt;dbo.CountNulls(EndDate)from HumanResources.EmployeeDepartmentHistory&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Summary:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Each class or struct should be public and dedicated for only one aggregate function.&lt;/p&gt;
&lt;p&gt;Serialization is required so SQLCLR could store the representation of the aggregate on disk.&lt;/p&gt;
&lt;p&gt;Note that this aggregate function can only take one parameter, we can&amp;#39;t implement aggregation with more than one parameter in SQL Server 2005, but we can with SQL Server 2008 and I&amp;#39;ll post about it later.&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=27120" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term=".NET Framework" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/.NET+Framework/default.aspx" /><category term="SQL SERVER 2005" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/SQL+SERVER+2005/default.aspx" /><category term="SQL CLR" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/SQL+CLR/default.aspx" /></entry><entry><title>Microsoft 2008 Package</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/05/microsoft-2008-package.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/05/microsoft-2008-package.aspx</id><published>2008-06-05T07:26:00Z</published><updated>2008-06-05T07:26:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;Recently I have been trying a lot of Microsoft new products, Visual Stdio 2008, SQL Server 2008 but I&amp;#39;ve never got to try Windows Server 2008, and while I was searching around for those new products I ran into this amazing downloadable web cast called Dynamic IT.&lt;/p&gt;
&lt;p&gt;&lt;a target="_self" href="http://www.microsoft.com/presspass/exec/kelly/default.mspx" class="null"&gt;Bob Kelly&lt;/a&gt;&amp;nbsp;introduces all those products, not only describing the new features but also showing&amp;nbsp;live demos.&lt;/p&gt;
&lt;p&gt;You can download this Dynamic IT &lt;a target="_self" href="http://www.microsoft.com/emea/spotlight/sessionh.aspx?videoid=720" class="null"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=27070" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term="Visual Studio 2008" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/Visual+Studio+2008/default.aspx" /><category term="SQL SERVER 2008" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/SQL+SERVER+2008/default.aspx" /><category term="Windows Server 2008" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/Windows+Server+2008/default.aspx" /></entry><entry><title>SQL CLR overview</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/04/sql-clr-overview.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/06/04/sql-clr-overview.aspx</id><published>2008-06-04T07:34:00Z</published><updated>2008-06-04T07:34:00Z</updated><content type="html">&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;SQL Server 2005 with it&amp;#39;s built in T-SQL as well as SQL SERVER Management Studio are just amazing, you can build your database, create your own procedures, functions and triggers. You can also access data, process information and update your records.&lt;/p&gt;
&lt;p&gt;Till now this is all fine, but what if you wanted to perform a complex processing a on the data, or apply a certain algorithm that require a lot of loops then you have to deal with a complex T-SQL code and a lot of cursors, which is not recommended for performance issues.&lt;/p&gt;
&lt;p&gt;The solution is to use the SQL CLR which is built into the SQL SERVER 2005 that allows us to run and execute .NET code with in SQL Server 2005 environment.SQL CLR enables developers to add user-defied functions,stored procedures and triggers as in T-SQL, but what it adds is the ability to define your own types as well as your own aggregate functions.&lt;/p&gt;
&lt;p&gt;Please read this &lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/ms131089.aspx" class="null"&gt;introduction to the SQL CLR&lt;/a&gt;&amp;nbsp;for more information.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Simple Example:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This following is an example&amp;nbsp;on how to use .NET code inside&amp;nbsp;SQL Server&amp;nbsp;2005:&lt;/p&gt;
&lt;p&gt;First, run Visual Studio 2008 or 2005, then create a new project from File -&amp;gt; New -&amp;gt; Project.&lt;/p&gt;
&lt;p&gt;Form the Project type chose Database project and select the SQL Server Project template and click OK.&lt;/p&gt;
&lt;p&gt;Then New Database Reference window is shown you can select the server name and then chose the database you want to work with, or you can attach a new database file to the server, test the connection and if every thing is good, just click OK and a dialog box will ask you if you want to enable debugging the .NET code for the current connection.&lt;/p&gt;
&lt;p&gt;Now to add a user defined function, right click on the project title then select Add -&amp;gt; User-Defined Function&lt;/p&gt;
&lt;p&gt;A&amp;nbsp;new C# class will be opened with the following code:&lt;/p&gt;
&lt;p&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Data.SqlClient;&lt;br /&gt;using System.Data.SqlTypes;&lt;br /&gt;using Microsoft.SqlServer.Server;&lt;/p&gt;
&lt;p&gt;public partial class UserDefinedFunctions&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Microsoft.SqlServer.Server.SqlFunction]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public static SqlString HelloWorld()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return new SqlString(&amp;quot;Hello&amp;quot;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;};&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Notice the name spaces that are already added to the class in order to make use of SQLCLR.&lt;/p&gt;
&lt;p&gt;As we can see above the function should be statice and should be attributed with [Microsoft.SqlServer.Server.SqlFunction] just to tell the SQLCLR to consider this function a user defined function so we can add it and use&amp;nbsp; it in our T-SQL code, we can also add any other not attributed functions, but will not be recognized as user defined functions by the SQLCLR.&lt;/p&gt;
&lt;p&gt;This user defined function returns a string but it&amp;#39;s not of the class String it&amp;#39;s of the class SqlString, the integer is also SqlInt32 etc...&lt;/p&gt;
&lt;p&gt;Now, we have implemented our function we can build our .NET class, and it will be compiled as a .NET library class.&lt;/p&gt;
&lt;p&gt;The last step now is to deploy this user defined function, in Visual Studio it&amp;#39;s so easy just go to Build menu and then select Deploy Solution, then VS will take care of creating an assembly in the SQL Server and will also create the user defined function and attached it with the function in that assembly, of course we can do it using T-SQL but VS takes care of every thing.&lt;/p&gt;
&lt;p&gt;Before calling the function we have to enable the SQLCLR inside the SQL Server because it&amp;#39;s disabled by default for security reasons.&lt;/p&gt;
&lt;p&gt;sp_configure &amp;#39;clr_enabled&amp;#39;,1&lt;/p&gt;
&lt;p&gt;reconfigure&lt;/p&gt;
&lt;p&gt;What else&amp;nbsp;we have to do?&amp;nbsp;actually nothing, but calling our user defined function that is written in C# but inside the SQL Server 2005 using a single select as follows:&lt;/p&gt;
&lt;p&gt;select dbo.HelloWorld()&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;At the end, SQL CLR is a great feature of the SQL Server 2005 that enables the use of the great features of the .NET Framework and classes. It doesn&amp;#39;t require too much code but&amp;nbsp;results a lot of&amp;nbsp;benifits.&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=27065" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term="SQL SERVER 2005" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/SQL+SERVER+2005/default.aspx" /><category term="SQL CLR" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/SQL+CLR/default.aspx" /></entry><entry><title>Visual Studio 2008 SP1 Beta installation note</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/05/24/visual-studio-2008-sp1-beta-installation-note.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/05/24/visual-studio-2008-sp1-beta-installation-note.aspx</id><published>2008-05-24T07:31:00Z</published><updated>2008-05-24T07:31:00Z</updated><content type="html">&lt;p&gt;Visual Studio 2008 Service Pack 1 Beta&amp;nbsp;released and you can &lt;a target="_self" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=CF99C752-1391-4BC3-BABC-86BC0B9E8E5A&amp;amp;displaylang=en" class="null"&gt;download it here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;But&amp;nbsp;if you previously installed a Visual Studio 2008 Hotfix, you must run the Hotfix Cleanup Utility before installing Visual Studio 2008 SP1 Beta.You&amp;nbsp;can download the&amp;nbsp;Visual Studio 2008 Hotfix Cleanup Utility for Installing Visual Studio 2008 SP1 Beta &lt;a target="_self" href="http://code.msdn.microsoft.com/RemoveKB944899/Release/ProjectReleases.aspx?ReleaseId=1030" class="null"&gt;here&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;And if you are using Windows VISTA you should install Service Pack 1 first.&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=26874" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term="Visual Studio 2008" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/Visual+Studio+2008/default.aspx" /></entry><entry><title>Default dot aspx</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/05/14/default-dot-aspx.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/05/14/default-dot-aspx.aspx</id><published>2008-05-14T09:59:00Z</published><updated>2008-05-14T09:59:00Z</updated><content type="html">&lt;p&gt;&lt;a target="_blank" href="http://www.defaultdotaspx.com/Default.aspx" class="null"&gt;Default.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;No, it&amp;#39;s not the name of a page written in ASP.NET, it&amp;#39;s a new great website for learning ASP.NET and all relevant technologies.&lt;/p&gt;
&lt;p&gt;It contains a lot of topics like: ASP.NET, SQL, JavaScript, OOP,XML, etc... &lt;/p&gt;
&lt;p&gt;Tutorials are presented in terms of question and answers, which is suitable for new ASP.NET programmers.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;By the way, you can ask your own questions there.&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=26767" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term="ASP.NET" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/ASP.NET/default.aspx" /></entry><entry><title>Transforming XML using XSLT</title><link rel="alternate" type="text/html" href="http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/05/13/transforming-xml-using-xslt.aspx" /><id>http://dotnetslackers.com/Community/blogs/basharkokash/archive/2008/05/13/transforming-xml-using-xslt.aspx</id><published>2008-05-13T07:38:00Z</published><updated>2008-05-13T07:38:00Z</updated><content type="html">&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Dealing with xml files as a place to store data is very common in ASP.NET, and it&amp;#39;s very easy to implement, just use the XmlDataSource and set the DataFile property to your xml file then set the DataSourceID of the data control (GrideView, DataList...) to the XmlDataSource.&lt;/p&gt;
&lt;p&gt;If data records in the xml file are described as attributes, then there is no problem while displaying the data records directly in the GrideView as the following example:&lt;/p&gt;
&lt;p&gt;&amp;lt;People&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Person name=&amp;quot;Bashar Kokash&amp;quot; age=&amp;quot;22&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Person name=&amp;quot;Bassl Kokash&amp;quot; age=&amp;quot;21&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Person name=&amp;quot;Mohave Musa&amp;quot; age=&amp;quot;25&amp;quot;/&amp;gt;&lt;br /&gt;&amp;lt;/People&amp;gt;&lt;/p&gt;
&lt;p&gt;But what if&amp;nbsp;the xml file was written in different way and the previous attributes are represented as child nodes instead, so the previous xml will look something like this:&lt;/p&gt;
&lt;p&gt;&amp;lt;People&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Person&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bashar Kokash&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;age&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/age&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Person&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Person&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Bassl Kokash&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;age&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 21&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/age&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Person&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Person&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Morhaf Musa&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/name&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;age&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 25&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/age&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Person&amp;gt;&lt;br /&gt;&amp;lt;/People&amp;gt;&lt;/p&gt;
&lt;p&gt;Simply we can rewrite the xml file to be just like what we want ie; as records each record is represented by node and a set of attributes. Actually it&amp;#39;s not that simple when dealing with large amount of data stored as xml. Instead we can Transform the xml file into the desired xml using the &lt;a href="http://www.w3schools.com/xsl/xsl_transformation.asp" class="null"&gt;XSL Transformation&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;To write code in XSLT add an XSLT File to your project,&amp;nbsp;remove the Template section &amp;nbsp;then format the template of the xml file that you want to get using XSLT tags, for the previous xml the following XSLT code will transform the xml hierarchical nodes into xml records as in the first example:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;lt;xsl:template match=&amp;quot;/&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:for-each select=&amp;quot;People&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:element name=&amp;quot;People&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:for-each select =&amp;quot;Person&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:element name =&amp;quot;Person&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:attribute name=&amp;quot;name&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select =&amp;quot;name&amp;quot;/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:attribute name =&amp;quot;age&amp;quot;&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;xsl:value-of select =&amp;quot;age&amp;quot;/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:attribute&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:for-each&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:element&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/xsl:for-each&amp;gt;&lt;br /&gt;&amp;nbsp; &amp;lt;/xsl:template&amp;gt;&lt;/p&gt;
&lt;p&gt;Then as a final step when setting the xml file to the XmlDataSource we have also to set the XSLT transformation file. Now we can bind our xml file to the GrideView having no problems.&lt;/p&gt;&lt;img src="http://dotnetslackers.com/Community/aggbug.aspx?PostID=26749" width="1" height="1"&gt;</content><author><name>BasharKokash</name><uri>http://dotnetslackers.com/Community/members/BasharKokash.aspx</uri></author><category term="XSLT" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/XSLT/default.aspx" /><category term="XML" scheme="http://dotnetslackers.com/Community/blogs/basharkokash/archive/tags/XML/default.aspx" /></entry></feed>