S
shil
Hi all,
I'm reading an XML file in to a DataSet object. Then trying to read
data from the XML file in to the database. I need to find if a
particular XML node exist in the file or not. For this I have the code
as below in VB.NET.
Dim objDSXML As New DataSet
Dim objDataRow
objDSXML.ReadXml("\Sample.xml")
If File.Exists("\Sample.xml") Then
For Each objDataRow In objDSXML.Tables(0).Rows
If objDSXML.Tables.IndexOf("Email") > -1 Then
Email = objDataRow("Email")
Else
Email = ""
End If
Next
End If
In my XML file even though the node <Email> exist, the If condition is
always returning -1. Is there some thing I'm missing here?
I'm reading an XML file in to a DataSet object. Then trying to read
data from the XML file in to the database. I need to find if a
particular XML node exist in the file or not. For this I have the code
as below in VB.NET.
Dim objDSXML As New DataSet
Dim objDataRow
objDSXML.ReadXml("\Sample.xml")
If File.Exists("\Sample.xml") Then
For Each objDataRow In objDSXML.Tables(0).Rows
If objDSXML.Tables.IndexOf("Email") > -1 Then
Email = objDataRow("Email")
Else
Email = ""
End If
Next
End If
In my XML file even though the node <Email> exist, the If condition is
always returning -1. Is there some thing I'm missing here?