A
Allan via DotNetMonster.com
I am trying to save the xml doc by using asp.net, and i also know how to add
the record.
Dim myDS As New DataSet("Job Information")
If System.IO.File.Exists(Server.MapPath("Hello.xml")) Then
myDS.ReadXml(Server.MapPath("Hello.xml"))
' add record to exist xml document
Dim myDR As DataRow = myDS.Tables("Data").NewRow()
myDR("ID") = txtJobID.Text
myDR("sentences") = txtPosition.Text
myDS.Tables("Data").Rows.Add(myDR)
myDS.WriteXml(Server.MapPath("Hello.xml"))
Else
' add new xml document
Dim myDT As DataTable = myDS.Tables.Add("Data")
myDT.Columns.Add("ID", System.Type.GetType("System.String"))
myDT.Columns.Add("sentences", System.Type.GetType("System.String")
)
Dim myDR As DataRow = myDS.Tables("Data").NewRow()
myDR("ID") = txtJobID.Text
myDR("sentences") = txtPosition.Text
myDS.Tables("Data").Rows.Add(myDR)
myDS.WriteXml(Server.MapPath("Hello.xml"))
End If
But i have a question. If i wanna enter groups of words, like
textbox1.text
have used multiLine)
Hello world
Hello my friend
that mean i want to break the sentance in 2 line, but in the xml doc, it save
as
<..>Hello worldHello my friend<..>
what can i do in programs so that xml doc can enter in two sentence...
Or using other enter methods can slove this problem?
thanks
Allan
the record.
Dim myDS As New DataSet("Job Information")
If System.IO.File.Exists(Server.MapPath("Hello.xml")) Then
myDS.ReadXml(Server.MapPath("Hello.xml"))
' add record to exist xml document
Dim myDR As DataRow = myDS.Tables("Data").NewRow()
myDR("ID") = txtJobID.Text
myDR("sentences") = txtPosition.Text
myDS.Tables("Data").Rows.Add(myDR)
myDS.WriteXml(Server.MapPath("Hello.xml"))
Else
' add new xml document
Dim myDT As DataTable = myDS.Tables.Add("Data")
myDT.Columns.Add("ID", System.Type.GetType("System.String"))
myDT.Columns.Add("sentences", System.Type.GetType("System.String")
)
Dim myDR As DataRow = myDS.Tables("Data").NewRow()
myDR("ID") = txtJobID.Text
myDR("sentences") = txtPosition.Text
myDS.Tables("Data").Rows.Add(myDR)
myDS.WriteXml(Server.MapPath("Hello.xml"))
End If
But i have a question. If i wanna enter groups of words, like
textbox1.text
Hello world
Hello my friend
that mean i want to break the sentance in 2 line, but in the xml doc, it save
as
<..>Hello worldHello my friend<..>
what can i do in programs so that xml doc can enter in two sentence...
Or using other enter methods can slove this problem?
thanks
Allan