> 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 commented out this:
'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
But I see no errors in the error list and I can still display the page
in the browser, both controls, no errors, but no updating of course to
the XML file... so the basic logic in my code must have a major flaw
(?)
> > 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
[quoted text clipped - 5 lines]
>
> It should give you an error.
Alexey Smirnov - 14 Jun 2007 21:52 GMT
> I commented out this:
>
[quoted text clipped - 23 lines]
>
> - Show quoted text -
<%@ Import Namespace="System.Data" %>
<script language="vb" 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") = "it works"
ds.WriteXml(Server.MapPath("timeline.xml"))
'Catch
'Finally
ds.Dispose()
'End Try
End Sub
</script>
<form id=form1 runat=server>
<asp:button id="btnSubmit" runat="server" text="Button" />
</form>
<?xml version="1.0" standalone="yes"?>
<xml>
<DataObjects>
<Event>it works</Event>
</DataObjects>
</xml>