Funkymonkey
11-04-2005, 06:27 AM
I have a console application where the results are displayed in the console window perfectly but when I save this data to a database, all the records are saved but with extra ones with null values. Can anyone help me work out why???
Here's where I get the data:
While (XmlReader.Read())
If XmlReader.Name = "a:displayname" Then
' Advance the reader to the text node.
XmlReader.Read()
addemail2()
Console.WriteLine("Subject: " + XmlReader.Value)
Console.ReadLine()
' Advance the reader to the closing a:displayname node.
XmlReader.Read()
ElseIf XmlReader.Name = "d:datereceived" Then
' Advance the reader to the text node.
XmlReader.Read()
addemail()
Console.WriteLine("Date&Time: " + XmlReader.Value)
Console.ReadLine()
' Advance the reader to the closing d:datereceived node.
XmlReader.Read()
'Advance the reader to the closing a:href node.
XmlReader.Read()
End If
End While
and here's where I save it:
Private Sub addemail()
Connect()
Row = ds.Tables("ITInfo2").NewRow
'Add each rows data to the correct column in the database
Row.Item("Received") = XmlReader.Value
ds.Tables("ITInfo2").Rows.Add(Row)
Adapter.Update(ds, "ITInfo2")
End Sub
Private Sub addemail2()
Connect()
Row = ds.Tables("ITInfo2").NewRow
'Add each rows data to the correct column in the database
Row.Item("Query") = XmlReader.Value
ds.Tables("ITInfo2").Rows.Add(Row)
Adapter.Update(ds, "ITInfo2")
End Sub
Thanks!!!
Here's where I get the data:
While (XmlReader.Read())
If XmlReader.Name = "a:displayname" Then
' Advance the reader to the text node.
XmlReader.Read()
addemail2()
Console.WriteLine("Subject: " + XmlReader.Value)
Console.ReadLine()
' Advance the reader to the closing a:displayname node.
XmlReader.Read()
ElseIf XmlReader.Name = "d:datereceived" Then
' Advance the reader to the text node.
XmlReader.Read()
addemail()
Console.WriteLine("Date&Time: " + XmlReader.Value)
Console.ReadLine()
' Advance the reader to the closing d:datereceived node.
XmlReader.Read()
'Advance the reader to the closing a:href node.
XmlReader.Read()
End If
End While
and here's where I save it:
Private Sub addemail()
Connect()
Row = ds.Tables("ITInfo2").NewRow
'Add each rows data to the correct column in the database
Row.Item("Received") = XmlReader.Value
ds.Tables("ITInfo2").Rows.Add(Row)
Adapter.Update(ds, "ITInfo2")
End Sub
Private Sub addemail2()
Connect()
Row = ds.Tables("ITInfo2").NewRow
'Add each rows data to the correct column in the database
Row.Item("Query") = XmlReader.Value
ds.Tables("ITInfo2").Rows.Add(Row)
Adapter.Update(ds, "ITInfo2")
End Sub
Thanks!!!