.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT

Home >> Code Snippets >> File Operation >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Display XML Attribute in ASP.NET

Posted By:Athira Sreejith       Posted Date: March 24, 2009    Points: 10    Category: File Operation    URL: http://www.dotnetspark.com  

Code sample demonstrate the XML attribute in a xml file using C# in asp.net

using System;

using System.Data;

using System.Configuration;

using System.Collections;

using System.Web;

using System.Web.Security;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Web.UI.HtmlControls;

using System.IO;

using System.Data.SqlClient;

using System.Xml;

using System.Text;

public partial class DisplayXMLattributes : System.Web.UI.Page


public string strHeader = "", strRows = "";

int i,j;

string[] arHeader,arRows,cell;

protected void Page_Load(object sender, EventArgs e)



protected void btnClick_Click(object sender, EventArgs e)


SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);


string qry = "select ProductID,ProductName from Products";

SqlCommand cmd = new SqlCommand(qry, con);

SqlDataAdapter ad = new SqlDataAdapter(cmd);

DataSet ds = new DataSet();


StringWriter sw = new StringWriter();

ds.WriteXml(sw, XmlWriteMode.WriteSchema);

string s = sw.ToString();






Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend