473,395 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Please help...writing to XML file

I have looked in all my books and online and can't find a way to make
this rather simple task work. Could someone please review the code and
see what errors I've made? Thanks!!!!!!

I have an aspx for with a textbox and a button. The goal is to simply
have the user type a message, hit the button and it should append to
the XML file. I can open the aspx in the browser with no problem, but
the XML file does not get updated. What's wrong with this code?
Thanks!

<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim ds As New DataSet()
ds.ReadXml(Server.MapPath("timeline.xml"))
txtNewEvent.DataBind()
ds.Dispose()
End If
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim ds As New DataSet()
Try
ds.ReadXml(Server.MapPath("timeline.xml"))
ds.Tables(0).Rows(0).Item("Event") = txtNewEvent.Text
ds.WriteXml(Server.MapPath("timeline.xml"))
Catch
Finally
ds.Dispose()
End Try
End Sub
</script>

Jun 14 '07 #1
1 2108
"slinky" <ca***************@yahoo.comwrote in message
news:11*********************@n15g2000prd.googlegro ups.com...
>I have looked in all my books and online and can't find a way to make
this rather simple task work. Could someone please review the code and
see what errors I've made? Thanks!!!!!!

I have an aspx for with a textbox and a button. The goal is to simply
have the user type a message, hit the button and it should append to
the XML file. I can open the aspx in the browser with no problem, but
the XML file does not get updated. What's wrong with this code?
Thanks!
I answered an earlier post of yours. Remove the Catch and see what happens.
--
John Saunders [MVP]
Jun 14 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
4
by: Carl Harris | last post by:
I am trying to write some code to: 1.Prompt a user for filenames 2.Open the files 3.Convert my plain text into a cipher text array/string bear in mind I am a novice! I have wriiten some code...
1
by: Sam Smith | last post by:
Dear All I would be really grateful if someone would help me. I have scoured the docs and the web for this I am writing a VC++ application, using .NET and Windows Forms. I am using Visual C++...
36
by: Cap'n Ahab | last post by:
I have used VB3 - VB6, so learning all this OO stuff is reasonably new to me (although I looked at Java a few years ago). Anyway, I thought I would write a small class to begin with, with a...
66
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
5
by: Kevin Wan | last post by:
fgen is a free command line tool that facilitates cross platform c++ development, including header generation, cpp file generation, makefile generation, unit test framework generation, etc. ...
22
by: Amali | last post by:
I'm newdie in c programming. this is my first project in programming. I have to write a program for a airline reservation. this is what i have done yet. but when it runs it shows the number of...
0
by: bibin mathew | last post by:
help me out.. this is a game and solve it by c++..how to play it is as follows.. There is a rectangular playing screen initially filled with several kinds of blocks at random. By selecting one of a...
4
by: pbd22 | last post by:
Hi. I am stuck on a part of my program and could use some help. I have a block of code that opens and writes to a text file. The idea is to keep the file open and keep writing to it until the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.