For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > August 2005 > Ask something about using XML in asp.net









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Ask something about using XML in asp.net
Allan via DotNetMonster.com

2005-08-31, 7:56 am

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


--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/Fo...sp-net/200508/1
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com