我有以下代码:
If dr("dlat").ToString <> "0.000000" Then
XmlWriter.WriteStartElement("mapped")
XmlWriter.WriteString("Yes")
XmlWriter.WriteEndElement()
Else
XmlWriter.WriteStartElement("mapped")
XmlWriter.WriteString("No")
XmlWriter.WriteEndElement()
End If
我想知道如何使用“是”或“否”部分。
原因是IF mapped = yes
然后在xml中添加地址,如果没有则不写地址。
XmlWriter.WriteStartElement("address")
XmlWriter.WriteCData(dr("sStreetNumber") & " " & dr("sStreetName"))
XmlWriter.WriteEndElement()
答案 0 :(得分:0)
If dr("dlat").ToString <> "0.000000" Then
XmlWriter.WriteStartElement("mapped")
XmlWriter.WriteString("Yes")
XmlWriter.WriteStartElement("address")
XmlWriter.WriteCData(dr("sStreetNumber") & " " & dr("sStreetName"))
XmlWriter.WriteEndElement()
Else
XmlWriter.WriteStartElement("mapped")
XmlWriter.WriteString("No")
XmlWriter.WriteEndElement()
End If
这应该可以正常工作吗?