S
Siegfried Heintze
The program below clearly populates the data set as seen by dumping the XML.
I'm using strongly typed data sets.
(1) Why does not my loop to dump row by row work? The record count is zero!
This is clearly wrong from the XML that is dumped!
(2) Why does not my attempt to add a new row work? I don't see "sari" in the
xml or the database when I am done!
Thanks
Siegfried
Dim sqlConnection As New System.Data.Odbc.OdbcConnection(cs)
Dim sqlCommand As New System.Data.Odbc.OdbcCommand(sel, sqlConnection)
'Dim ds As New DataSet()
Dim ds As New OdbcSimple_mdb4
Dim da As New System.Data.Odbc.OdbcDataAdapter(sel, sqlConnection)
da.Fill(ds)
Dim dt As DataTable = ds.Tables(0)
' Use the constructor that takes a type and XmlRootAttribute.
Dim ser1 As New
Xml.Serialization.XmlSerializer(GetType([OdbcSimple_mdb4]))
Dim tw1 As TextWriter = System.Console.Out
ser1.Serialize(tw1, ds)
#If noprompt Then
outp.WriteLine("exiting DisconnectedRS.vb")
#Else
outp.Write("Enter any key to continue DisconnectedRS.vb: ")
_getch()
#End If
Dim t As OdbcSimple_mdb4.simpleDataTable
t = ds.simple
outp.WriteLine("row count = " & t.Rows.Count)
Dim r As OdbcSimple_mdb4.simpleRow
For Each r In t
outp.WriteLine(r.sDescription & "," & r.dtCreation)
Next
r = t.NewRow
r.dtCreation = New DateTime(2008, 6, 18)
r.sDescription = "Sari"
ds.simple.AcceptChanges()
Dim ser2 As New
Xml.Serialization.XmlSerializer(GetType([OdbcSimple_mdb4]))
Dim tw2 As TextWriter = System.Console.Out
ser2.Serialize(tw2, ds)
I'm using strongly typed data sets.
(1) Why does not my loop to dump row by row work? The record count is zero!
This is clearly wrong from the XML that is dumped!
(2) Why does not my attempt to add a new row work? I don't see "sari" in the
xml or the database when I am done!
Thanks
Siegfried
Dim sqlConnection As New System.Data.Odbc.OdbcConnection(cs)
Dim sqlCommand As New System.Data.Odbc.OdbcCommand(sel, sqlConnection)
'Dim ds As New DataSet()
Dim ds As New OdbcSimple_mdb4
Dim da As New System.Data.Odbc.OdbcDataAdapter(sel, sqlConnection)
da.Fill(ds)
Dim dt As DataTable = ds.Tables(0)
' Use the constructor that takes a type and XmlRootAttribute.
Dim ser1 As New
Xml.Serialization.XmlSerializer(GetType([OdbcSimple_mdb4]))
Dim tw1 As TextWriter = System.Console.Out
ser1.Serialize(tw1, ds)
#If noprompt Then
outp.WriteLine("exiting DisconnectedRS.vb")
#Else
outp.Write("Enter any key to continue DisconnectedRS.vb: ")
_getch()
#End If
Dim t As OdbcSimple_mdb4.simpleDataTable
t = ds.simple
outp.WriteLine("row count = " & t.Rows.Count)
Dim r As OdbcSimple_mdb4.simpleRow
For Each r In t
outp.WriteLine(r.sDescription & "," & r.dtCreation)
Next
r = t.NewRow
r.dtCreation = New DateTime(2008, 6, 18)
r.sDescription = "Sari"
ds.simple.AcceptChanges()
Dim ser2 As New
Xml.Serialization.XmlSerializer(GetType([OdbcSimple_mdb4]))
Dim tw2 As TextWriter = System.Console.Out
ser2.Serialize(tw2, ds)