Ads 468x60px

For New Update Use this Link Offer for you


Sunday, 6 October 2013

Generating Xml file From Mysql database

Generating XML FILE From MySQL database
Introduction :- In this article i have explain how to  generate  XML  File   from mysql database in .

Description :- In my previous article i have explain Crete and read XML file in   and  read data from XML file in . Now i am explain how to generate  XML file in

Step 1 :- Create table  for generate xml file using mysql database. Table structure as show below

CREATE TABLE `user_tab` (
  `User_Name` varchar(50) DEFAULT NULL,
  `Contact_No` varchar(50) DEFAULT NULL,
  `Donet_Values` float DEFAULT NULL,
  `Donate_Date` datetime DEFAULT NULL,
  `User_Email` varchar(50) DEFAULT NULL,

GUI table structure as show below

Step 2:- create a new web  application and add  new page and write this code on web page as show below

//generat xml file and save in folder
    protected void Button1_Click(object sender, EventArgs e)
        MySqlConnection con = new MySqlConnection("server=localhost;User Id=root;database=database Name;password=Your Password;Pooling=false;");
        string str = "select * from slider_tab1 ";
        MySqlDataAdapter da = new MySqlDataAdapter(str,con);
        DataSet ds = new DataSet();
        lblmsg.Text = "XML File Created Successfully";

Explanation -: Here i take a new web page and drag and drop  a button and one label for show the message file is created and write this code on button click event.

In this code i  have selected  all the data from mysql  database and create a object of mysql DataAdapter and create DaSet and fill all the DataAdapter values in Dataset and save the file in xml format in  xmlfile folder

Note- If you use mysql database then use the mysql to connector for connect the MySQL database to

No comments:

Post a Comment



New Updates

Related Posts Plugin for WordPress, Blogger...

Related Result