example of Inserting and Retrieving data from xml file

This is a discussion on "example of Inserting and Retrieving data from xml file" within the Classic ASP section. This forum, and the thread "example of Inserting and Retrieving data from xml file are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > Classic ASP

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Sep 25th, 2007, 12:53
New Member
Join Date: Sep 2007
Location: gurgaon
Age: 22
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
example of Inserting and Retrieving data from xml file

This is an example of Inserting and Retrieving data from xml file.

Code: Select all
private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            
            if(!IsPostBack)
            {
                BindGrid();
            }
        }

        
private void BindGrid()
        {
            ds = new DataSet();
            try
            {
                ds.ReadXml(@"c:\inetpub\wwwroot\WebApplication10\XMLFile1.xml");
                DataGrid1.DataSource = ds;
                DataGrid1.DataBind();
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }


        

    private void Button1_Click(object sender, System.EventArgs e)
        {
            ds = new DataSet();
            try
            {
                ds.ReadXml(@"c:\inetpub\wwwroot\WebApplication10\XMLFile1.xml");
                DataRow row = ds.Tables[0].NewRow();
                row["name"]=txtName.Text;
                row["fathersname"]=txtFName.Text;
                row["address"]=txtAddress.Text;
                ds.Tables[0].Rows.Add(row);
                ds.WriteXml(@"c:\inetpub\wwwroot\WebApplication10\XMLFile1.xml");
                txtAddress.Text="";
                txtFName.Text="";
                txtName.Text ="";
                BindGrid();
            }
            catch(Exception ex)
            {
                throw ex;
            }

Last edited by karinne; Sep 25th, 2007 at 13:01. Reason: Removed links and no signatures allowed until you reach 10 posts.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Sep 25th, 2007, 17:21
alexgeek's Avatar
Moderator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,812
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
Re: example of Inserting and Retrieving data from xml file

This was just for people to look at right? you don't have problem with it?
If so thanks I will probably need this soon as I'm getting into ASP
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)

Last edited by alexgeek; Sep 25th, 2007 at 17:21. Reason: removed huge quote :)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for button to refresh page after inserting data in sql db wacara JavaScript Forum 0 Apr 27th, 2007 02:45
Working with Form 'file field' data in ASP. daryl Classic ASP 3 Jun 24th, 2006 20:22
Creating A new Data BAse from .txt file JamieH Databases 3 Jan 28th, 2006 23:26
Setting/Retrieving Cookies Mike Henson Web Page Design 2 Jan 10th, 2006 20:34
inserting data to mysql db Tim356 PHP Forum 1 May 6th, 2005 04:20


All times are GMT. The time now is 15:52.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42