Hello, i try to develop some application for inventory and transaction using VB.Net with database access
i have a problem with query result, it looks like not using newest database when application already run.
for example :
i have MS access table like this
ID CustomerName
1 John
2 Doe

then i run my application and do search by ID, then i add new row directly using MS access to the table
3 John Doe

then i search ID = 3 , the result is not found. Help me please , thanks

Here is my codes.

    Public Sub ConnOpen()
        conn = New OleDb.OleDbConnection
        conn.ConnectionString = dbProvider & dbSource
    End Sub

    Public Sub ConnClose()
    End Sub

    Public Function GetData(query As String, tbl As String)
        Dim da = New OleDb.OleDbDataAdapter(query, conn)
        Dim ds As New DataSet
        da.Fill(ds, tbl)
        Return ds
    End Function

    Public Function FindBarang(vcode As String)

        Dim query As String
        query = "SELECT * FROM "
        query &= "People "
        query &= "WHERE ID = " & vcode

        Dim data As DataSet = GetData(query, "FPeople")

        Return data.Tables("FPeople").Rows
    End Function
3 Years
Discussion Span
Last Post by Agus_1

Close your connection and reopen it after adding/editing database directly from Access.

Edited by Santanu Das


thank you, i just realize it that i made a mistake. i edit the database which not in debug folder. that's why it not using newest database
thanks sir for your reply, it really help me a lot. thanks once again.

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.