continuous insert/add to xml file vb.net
<gamerecord>
<Record>
<adate></adate>
<IMEI></IMEI>
<coin></coin>
<type></type>
<gameresult></gameresult>
</Record>
</gamerecord>
this is my xml file pattern(above sample) but I can't continuous add new
node(sample below)
<gamerecord>
<Record>
<adate></adate>
<IMEI></IMEI>
<coin></coin>
<type></type>
<gameresult></gameresult>
</Record>
<Record>
<adate></adate>
<IMEI></IMEI>
<coin></coin>
<type></type>
<gameresult></gameresult>
</Record>
</gamerecord>
this is my coding(vb.net)
Dim xDoc As New XmlDocument
Dim xNode As XmlNode = xDoc.AppendChild(xDoc.CreateElement("Record"))
Dim xadate As XmlNode = xNode.AppendChild(xDoc.CreateElement("adate"))
xadate.InnerText = DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")
Dim xIMEI As XmlNode = xNode.AppendChild(xDoc.CreateElement("IMEI"))
xIMEI.InnerText = value
Dim xcoin As XmlNode = xNode.AppendChild(xDoc.CreateElement("coin"))
xcoin.InnerText = value
Dim xtype As XmlNode = xNode.AppendChild(xDoc.CreateElement("type"))
xtype.InnerText = value
Dim xgameresult As XmlNode =
xNode.AppendChild(xDoc.CreateElement("gameresult"))
xgameresult.InnerText = value
xDoc.Save(aConfig.pathxml)
I try few method but the value replace my latest record, how I can
continuous adding new record?
No comments:
Post a Comment