S
Siegfried Heintze
I have created a simple three column database where the first column is
auto-increment.
Can someone help me change my program so that it reads the entire table and
appends a new row and saves that new row in the mdb file?
I'm trying to use a strongly typed dataset called DataSet3 and the line 28
never executes. It just skips to line 30.
Can someone tell me what I am doing wrong?
Thanks,
Siegfried
1 Imports System.Data.OleDb
2 Imports System.Data.Odbc
3 Imports System.Data.Sql
4
5 Module DisconnectedRS
6 Dim outp As System.IO.TextWriter = System.Console.Out
7 Dim inp As System.IO.TextReader = System.Console.In
8 Sub Main(args() as String)
9 Dim arg as String
10 For Each arg in args
11 outp.WriteLine(" arg = " & arg)
12 Next
13 Dim cs As String
14 cs = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=simple.mdb;User Id=admin;Password=;"
15 Dim conn As New OleDb.OleDbConnection(cs)
16 conn.Open()
17 Dim sel As New String("SELECT * FROM SIMPLE")
18 Dim cmd As New OleDbCommand()
19
20 Dim ds As New DataSet3()
21 Dim da As New OleDbDataAdapter(sel, cs)
22
23 da.Fill(ds)
24 Dim r As DataSet3.descriptionRow
25 Dim t As DataSet3.descriptionDataTable
26 t = ds.description
27 For Each r In t
28 outp.WriteLine(r.sDescription & "," & r.dtCreation)
29 Next
30 r = t.NewRow
31 r.dtCreation = New DateTime(2008, 6, 18)
32 r.sDescription = "Sari"
33 ds.description.AcceptChanges()
34 End Sub
35 End Module
auto-increment.
Can someone help me change my program so that it reads the entire table and
appends a new row and saves that new row in the mdb file?
I'm trying to use a strongly typed dataset called DataSet3 and the line 28
never executes. It just skips to line 30.
Can someone tell me what I am doing wrong?
Thanks,
Siegfried
1 Imports System.Data.OleDb
2 Imports System.Data.Odbc
3 Imports System.Data.Sql
4
5 Module DisconnectedRS
6 Dim outp As System.IO.TextWriter = System.Console.Out
7 Dim inp As System.IO.TextReader = System.Console.In
8 Sub Main(args() as String)
9 Dim arg as String
10 For Each arg in args
11 outp.WriteLine(" arg = " & arg)
12 Next
13 Dim cs As String
14 cs = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=simple.mdb;User Id=admin;Password=;"
15 Dim conn As New OleDb.OleDbConnection(cs)
16 conn.Open()
17 Dim sel As New String("SELECT * FROM SIMPLE")
18 Dim cmd As New OleDbCommand()
19
20 Dim ds As New DataSet3()
21 Dim da As New OleDbDataAdapter(sel, cs)
22
23 da.Fill(ds)
24 Dim r As DataSet3.descriptionRow
25 Dim t As DataSet3.descriptionDataTable
26 t = ds.description
27 For Each r In t
28 outp.WriteLine(r.sDescription & "," & r.dtCreation)
29 Next
30 r = t.NewRow
31 r.dtCreation = New DateTime(2008, 6, 18)
32 r.sDescription = "Sari"
33 ds.description.AcceptChanges()
34 End Sub
35 End Module