Announcement

Transforming XML to HTML using LINQ to XML



Converting XML to HTML using C#
XML to HTML
In the post Create xml file in C# .net, we got to know about how to create XML file in C#. As mentioned in the previous post, XML helps creating our own tags and it focuses on what data is rather than how data looks. But... many a times it is important how data looks, to get the better look and feel. Thus need arises to convert the XML data into HTML format.

In this post we will convert XML file that we created previously into HTML format.

Create xml file in C# .net


Creating XML file in C# .net

xml file
Students.xml


Often we require to create text file or csv file, excel file, some other kind of file for reporting purpose. As a Developer, we often require to create an xml file for easily manipulating or rendering the data on the view. XML stands for EXtensible Markup Language.

It allows us to create our own tags. Unlike HTML, it focuses on what data is rather than how data looks. XML simplifies data transportation and data sharing since data is stored in plain text format and thus provides a hardware and software independent way of storing data.

It uses System.Xml.Linq; namespace.

The XML file that we create will have the following structure:

SQL Query Performance Issue

SQL Query Performance Issue
SQL Query Performance
SQL Query Performance

As a developer we need to take care a lot of performance of the system that we develop. Recently in one of my project I got a task to check the performance of the query. I tried with three different ways using joins each returning the same result. BUT...

Create a method that execute a SP irrespective of number of parameters.

Execute Stored Procedure
We as a developer always use Stored Procedure for retrieving results from database. We write code to execute stored procedure and pass all the required parameters using Command Object. But writing all code including connection string, command object, AddWithValue() parameters and executing it every time when you have to execute a stored procedure with different parameters is a tedious task. As a developer, we must be lazy while writing our code which give rise to re-usability. This post will explain how to execute Stored Procedure irrespective of the number parameters where in we just have to pass command object and an empty DataSet object to retrieve the result.

How to change the name of project in visual studio?

This post will explain simple steps for changing the name of Project in Visual Studio including all the directories of layered architecture.

Step 1: Right click on the solution file->Open With Notepad.

Step 2: CTRL+H and type ExistingProjectName in Find What and NewProjectName in Replace With textboxes.

Step 3: Click on Replace All

Step 4: CTRL+S to save and close it.

Step 5: Now open the project as usual with Visual Studio.

NOTE : You don't need to edit or change the references. Just run the project.