A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Wanted: help with minimal ADO.NET in VS 2008



 
 
Thread Tools Display Modes
  #1  
Old June 17th, 2008, 04:35 AM posted to microsoft.public.access.tablesdbdesign
Siegfried Heintze[_2_]
external usenet poster
 
Posts: 4
Default Wanted: help with minimal ADO.NET in VS 2008

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

  #2  
Old June 17th, 2008, 10:35 AM posted to microsoft.public.access.tablesdbdesign
Stefan Hoffmann
external usenet poster
 
Posts: 709
Default Wanted: help with minimal ADO.NET in VS 2008

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 --

  #3  
Old June 17th, 2008, 06:22 PM posted to microsoft.public.access.tablesdbdesign
Siegfried Heintze[_2_]
external usenet poster
 
Posts: 4
Default Wanted: help with minimal ADO.NET in VS 2008

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 --


  #4  
Old June 17th, 2008, 10:32 PM posted to microsoft.public.access.tablesdbdesign
Siegfried Heintze[_2_]
external usenet poster
 
Posts: 4
Default Wanted: help with minimal ADO.NET in VS 2008

I can make this work with late bound data sets but not early bound. Can
someone tell me why?

Thanks,
Siegfried
  #5  
Old June 18th, 2008, 09:31 AM posted to microsoft.public.access.tablesdbdesign
Stefan Hoffmann
external usenet poster
 
Posts: 709
Default Wanted: help with minimal ADO.NET in VS 2008

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 --
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:43 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.