Database table to XML file

Here I give an example of how we can create a XML file from a database table.

In this example, I had populated a dropdownlist with the tables in a database. Then I choose a table from the list, which needs to be generated as a XML file.

Listing all the tables in the Database

Listing all the tables in the Database

We will generate the XML file in the ‘SelectedIndexChanged’ event of the DropDownList.

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
DataSet ds = new DataSet();

//Create the connection object
SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings[ "LMSConnectionString"].ToString());

string strQuery = "Select * from " + DropDownList1.SelectedItem.Text;

SqlCommand sqlCmd = new SqlCommand(strQuery, sqlConn);
SqlDataAdapter sqlAdptr = new SqlDataAdapter(sqlCmd);

XmlDataDocument doc = new XmlDataDocument(ds);

//The name of the XML file to be generated
catch{ }

The above code will generate an XML file with the same name of the database table selected, in the root directory.


Microsoft’s WebsiteSpark Program

Microsoft announced a new program which is designed for independent web developers and web development companies that build web applications and web sites on behalf of others. This program offers software licence that we can use for three years at no cost.

Here is a list of software which can be downloaded once you enrolled in to this program:

  • 3 licenses of Visual Studio 2008 Professional Edition
  • 1 license of Expression Studio 3 (which includes Expression Blend, Sketchflow, and Web)
  • 2 licenses of Expression Web 3
  • 4 processor licenses of Windows Web Server 2008 R2
  • 4 processor licenses of SQL Server 2008 Web Edition
  • DotNetPanel control panel (enabling easy remote/hosted management of your servers)

The only two requirements to join the program are:

  • Your company builds web sites and web application on behalf of others.
  • Your company currently has less than 10 employees.

For more information check:

ScottGu’s Blog or Microsoft’s site.

Ajax Loading Images

Here is a site from where you can generate your-own ajax loading images.

Easy as 1-2-3

1. Select type of indicator, background color and foreground color.
2. Generate the image.
3. Download the generated image.