I have a problem with retrieving data from access databse.
I make the connection and retrieve the data no problem. But when the data changes from another use of the database, I cannot get the new changed data without reloading the complete programme. Even repeating the load functions does not renew the data from the access data base.

Here is what I have got:

Public Class Form1
    Private comm As New CommManager()
    Private transType As String = String.Empty

    Dim inc As Integer
    Dim con As New OleDb.OleDbConnection
    Dim dbProvider As String
    Dim dbSource As String
    Dim laptimes As New DataSet

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        dbProvider = "PROVIDER=Microsoft.Jet.OLEDB.4.0;"
        dbSource = "Data Source = f:/HareHound riderinput local.mdb;"

        con.ConnectionString = dbProvider & dbSource

        sql = "SELECT * FROM laptimes"

        da = New OleDb.OleDbDataAdapter(sql, con)
        da.Fill(laptimes, "HareHounds")


    End Sub
Private Sub btnimportdata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnimportdata.Click
                CheckBox1.Checked = laptimes.Tables("HareHounds").Rows(0).Item(10)
    End Sub

I have tried everthing to get this very simple thing to work, but I am at a loss. Help would be largly apreciated.

Votes + Comments
how toget start with data base
4 Years
Discussion Span
Last Post by UKnod

Move that code out of the form_load event into its own function. You can call that function from form_load to get the data at startup but you will also be able to call the code at anytime to get any new data (via a button that calls that function for example)


Yes I tried that, but it does not make any difference.
Odly enough I have writed another console based programe with pretty much the sanme code, and that does work.
What is the difference?


sorry but backups has nothing to do with this subject?


I solved this my self in the end. What you have to do is make a seperate function that contains a OleDb.OleDbCommandBuilder and an update comanad.
This then updates the real database and not the one loaded into memnory. Seems like an od way to do things but it works.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.