Hi,
I am using MS-Access 2003, VB.NET 2008, I am able to select and delete recordes. But how can I move between records?

Imports System.Data.OleDb
Class Window1
    Dim cn As OleDbConnection
    Dim cmd As OleDbCommand
    Dim dr As OleDbDataReader

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button1.Click 
        cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\emp.mdb;")
        cmd = New OleDbCommand("select * from table1", cn)
        cn.Open()
        dr = cmd.ExecuteReader
            TextBox1.Text = dr(0)
            TextBox2.Text = dr(1)

    End Sub
End Class

This is what I have done so far but how can I movenext,last,previous,first? The way we used to in vb6 with recordsource.

The data reader is a forward only way of moving through the data extracted. You can use other types if you want to be able to arbitrarily select a position. The dataTable can be referenced by iterating through the rows so moving back forward is easy.

Hi Hericles,
I changed my program and used combobox instead. Thanx for the reply :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.