Click here to Skip to main content
15,902,445 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: AdoDc in VB Express 2008 Eof not set Pin
Dave Kreskowiak22-Oct-09 12:39
mveDave Kreskowiak22-Oct-09 12:39 
GeneralRe: AdoDc in VB Express 2008 Eof not set Pin
Henry Minute22-Oct-09 11:30
Henry Minute22-Oct-09 11:30 
AnswerRe: AdoDc in VB Express 2008 Eof not set Pin
Dave Kreskowiak22-Oct-09 9:31
mveDave Kreskowiak22-Oct-09 9:31 
GeneralRe: AdoDc in VB Express 2008 Eof not set Pin
Les Singletary22-Oct-09 10:24
Les Singletary22-Oct-09 10:24 
GeneralRe: AdoDc in VB Express 2008 Eof not set Pin
Dave Kreskowiak22-Oct-09 10:55
mveDave Kreskowiak22-Oct-09 10:55 
GeneralRe: AdoDc in VB Express 2008 Eof not set Pin
Les Singletary22-Oct-09 11:13
Les Singletary22-Oct-09 11:13 
GeneralRe: AdoDc in VB Express 2008 Eof not set Pin
Dave Kreskowiak22-Oct-09 12:41
mveDave Kreskowiak22-Oct-09 12:41 
AnswerRe: AdoDc in VB Express 2008 Eof not set Pin
Les Singletary22-Oct-09 11:33
Les Singletary22-Oct-09 11:33 
Here is the code for the entire program demostrating the problem. I don't seem to be able to attach a zipped file. You will need to create a form with three controls: Button1, Button2, and Adodc1. Name the form "frmAdoDc". You will need a simple MS Access DB named "Stu" with a table named "Student". The table contains 2 columns: "Id" and "Name". Put the database in the same folder where you store the code below. I hope some one can find how to make this code work. Thanks!
---------------------------------------------------------
Imports ADODB

Public Class frmAdoDc
   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      Dim iX As Integer

      With Adodc1.Recordset
         .MoveFirst()
         Do While Adodc1.EOF = False And iX < 10
            iX = iX + 1   'needed because of problem
            Debug.Print(.Fields("Name").Value)
            .MoveNext()
         Loop
      End With
   End Sub

   Private Sub frmAdoDc_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
      Dim sDir As String = "AdoDc_Example"      'path of root folder for solution
      Dim sDb As String = "Stu.Mdb"               'name of database
      Dim sFid As String                                 'path &amp; name of database
      Dim iPos As Integer
      '---build path where DB is regardless of where this test is stored
      sFid = My.Application.Info.DirectoryPath
      iPos = sFid.IndexOf(sDir)
      sFid = sFid.Substring(0, iPos + sDir.Length + 1) &amp; sDb

      With Adodc1
         .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _
                              "Data Source=" &amp; sFid &amp; ";"
         .RecordSource = "Student"
         .Refresh()
      End With
   End Sub

   Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
      Dim iX As Integer
      Dim db As New ADODB.Connection
      Dim rs As New ADODB.Recordset

      db.Open("Provider=Microsoft.Jet.OLEDB.4.0;" &amp; _
                           "Data Source=C:\VbNet_Test\AdoBasics\Stu2.mdb;")
      rs.Open("Select * From Student", db, CursorTypeEnum.adOpenDynamic)

      With rs
         .MoveFirst()
         Do While iX < 10 And .EOF = False
            Debug.Print(.Fields("Name").Value)
            iX = iX + 1
            .MoveNext()
         Loop
      End With

      rs.Close()
      db.Close()
   End Sub
End Class
GeneralRe: AdoDc in VB Express 2008 Eof not set Pin
Les Singletary22-Oct-09 15:05
Les Singletary22-Oct-09 15:05 
Questionaaaahhhhhhhhh copy and pasting and reading and writing in txt documents Pin
offroaderdan22-Oct-09 5:48
offroaderdan22-Oct-09 5:48 
AnswerRe: aaaahhhhhhhhh copy and pasting and reading and writing in txt documents Pin
dan!sh 22-Oct-09 7:08
professional dan!sh 22-Oct-09 7:08 
AnswerRe: aaaahhhhhhhhh copy and pasting and reading and writing in txt documents Pin
John M Bundy22-Oct-09 7:25
John M Bundy22-Oct-09 7:25 
QuestionCopy and paste .txt documents and rename them Pin
offroaderdan22-Oct-09 2:40
offroaderdan22-Oct-09 2:40 
AnswerRe: Copy and paste .txt documents and rename them Pin
dan!sh 22-Oct-09 3:53
professional dan!sh 22-Oct-09 3:53 
QuestionVisual time reservation/ Visual Basic Pin
MarisLV22-Oct-09 1:18
MarisLV22-Oct-09 1:18 
AnswerRe: Visual time reservation/ Visual Basic Pin
tosch22-Oct-09 1:33
tosch22-Oct-09 1:33 
AnswerRe: Visual time reservation/ Visual Basic Pin
thebathroomguy22-Oct-09 2:36
thebathroomguy22-Oct-09 2:36 
Questioninteraction between two datagridview Pin
helelark12322-Oct-09 1:06
helelark12322-Oct-09 1:06 
AnswerRe: interaction between two datagridview Pin
Steve Westbrook22-Oct-09 2:21
Steve Westbrook22-Oct-09 2:21 
GeneralRe: interaction between two datagridview Pin
helelark12322-Oct-09 4:17
helelark12322-Oct-09 4:17 
QuestionSaving Integer Array Pin
O.G.I.22-Oct-09 0:39
O.G.I.22-Oct-09 0:39 
AnswerRe: Saving Integer Array Pin
dan!sh 22-Oct-09 0:49
professional dan!sh 22-Oct-09 0:49 
GeneralRe: Saving Integer Array Pin
O.G.I.22-Oct-09 4:57
O.G.I.22-Oct-09 4:57 
GeneralRe: Saving Integer Array Pin
dan!sh 22-Oct-09 5:17
professional dan!sh 22-Oct-09 5:17 
QuestionHandle changes in the system control panel in application program Pin
gilchinger22-Oct-09 0:12
gilchinger22-Oct-09 0:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.