|
Prev: Handling Transfers
Next: Database creating
From: Siegfried Heintze on 16 Jun 2008 23:35 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
From: Stefan Hoffmann on 17 Jun 2008 05:35 Siegfried Heintze schrieb: > 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? hmm... > 25 Dim t As DataSet3.descriptionDataTable > 26 t = ds.description Does this really fill your table? Is there a t.Count or any similar property which gives you the number of records within your t? mfG --> stefan <--
From: Siegfried Heintze on 17 Jun 2008 13:22 Yeah -- that is the problem: t.Rows.Count is zero. I checked it. Why? What am I doing wrong? "Stefan Hoffmann" wrote: > Siegfried Heintze schrieb: > > 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? > hmm... > > > 25 Dim t As DataSet3.descriptionDataTable > > 26 t = ds.description > Does this really fill your table? Is there a t.Count or any similar > property which gives you the number of records within your t? > > > mfG > --> stefan <-- > >
From: Siegfried Heintze on 17 Jun 2008 17:32 I can make this work with late bound data sets but not early bound. Can someone tell me why? Thanks, Siegfried
From: Stefan Hoffmann on 18 Jun 2008 04:31 hi Siegfried, Siegfried Heintze wrote: > Yeah -- that is the problem: t.Rows.Count is zero. I checked it. Why? What am > I doing wrong? Just a look at to OH for da.Fill(). It seems that you need the parameter srcTable. So da.Fill(ds, "simple") works as intended. mfG --> stefan <--
|
Pages: 1 Prev: Handling Transfers Next: Database creating |