troubleshooting Question

DataGridView - Save data to access database VB.net

Avatar of AnthonySmithMCP
AnthonySmithMCPFlag for United States of America asked on
Microsoft Access.NET ProgrammingMicrosoft Development
13 Comments1 Solution24785 ViewsLast Modified:
Good afternoon,

I've been searching all over the web for help with this but I'm not getting exactly what I want. I have an application that uses an access database. The data shows in DataGridView. Its displaying the data just fine in the datagridview but when I make changes in the DataGridView, its not saving. Please review my code and tell me what I'm doing wrong?

    Private Sub GetData_BRL_Click(sender As Object, e As EventArgs) Handles GetData_BRL.Click
        Dim con As New OleDbConnection
        Dim ds As New DataSet
        Dim dt As New DataTable
        Dim da As New OleDbDataAdapter

        con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\data\PersonelTracker.accdb"
        con.Open()
        ds.Tables.Add(dt)
        da = New OleDbDataAdapter("Select * from BadgeRequestLog", con)
        da.Fill(dt)
        DG_BRL.DataSource = dt.DefaultView
        con.Close()


    End Sub


    Private Sub Upload_BRL_Click(sender As Object, e As EventArgs) Handles Upload_BRL.Click

        Dim con As New OleDbConnection
        Dim ds As New DataSet
        Dim dt As New DataTable
        Dim da As New OleDbDataAdapter

        con.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=c:\data\PersonelTracker.accdb"
        con.Open()
        ds.Tables.Add(dt)
        da = New OleDbDataAdapter("Select * from BadgeRequestLog", con)
        da.Update(dt)
        con.Close()

    End Sub
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros