User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 423,741 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,438 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 2535 | Replies: 2
Reply
Join Date: Sep 2007
Posts: 6
Reputation: hanusoft is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
hanusoft hanusoft is offline Offline
Banned

Example of Inserting and Retrieving data from xml file

  #1  
Sep 29th, 2007
This is an example of Inserting and Retrieving data from xml file.

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 stymiee : Sep 29th, 2007 at 1:01 pm. Reason: url removed
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2008
Posts: 3
Reputation: monjuri is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
monjuri monjuri is offline Offline
Newbie Poster

Re: Example of Inserting and Retrieving data from xml file

  #2  
Mar 29th, 2008
hello hanusoft,
i have been trying to insert data from my project which i m doing using asp.net and the language is c#.
i have tried ur code.
it has given 4 errors.
Error 1

'ASP.default_aspx.GetTypeHashCode()': no suitable method found to override
the file where the error occurs

c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\firstasp\2e57531e\
3fdfeee\App_Web_komf0cr-.2.cs

the rest of the problem occurs in the same file.
can u tell me what is the wrong with here?
Reply With Quote  
Join Date: Jun 2006
Posts: 12
Reputation: Hosam Kamel is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Hosam Kamel Hosam Kamel is offline Offline
Newbie Poster

Re: Example of Inserting and Retrieving data from xml file

  #3  
Apr 4th, 2008
are you using a BasePage or override any methods manually ?
Thanks,
Hosam Kamel
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb ASP.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 1:30 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC