Question Update Database using datagridview

confused

New member
Joined
Sep 2, 2009
Messages
2
Programming Experience
Beginner
I am building an application in which I am using Ms Access as the database.
Now when somebode searches the data is shown in Datagridview conrol using only dataadapter and dataset methods
Now I want that if user do the chenges in the DataGridView and then clicks on update button then data should gets updated.

But I am not finding any way to do that......


I am compeletely confused.....

Please help me out
 

henryminute

Well-known member
Joined
Jul 24, 2009
Messages
57
Location
UK
Programming Experience
10+
Try this:
VB.NET:
    ' Save data from DataGridView into Database

    Private Sub updateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles updateButton.Click
        Me.Validate()
        Me.myDA.Update(Me.myDataSet.Tables("MyTable"))
        Me.myDataSet.AcceptChanges()
    End Sub

Hope this helps! :)
 

higkiller

New member
Joined
May 9, 2014
Messages
1
Programming Experience
Beginner
Try this:
VB.NET:
    ' Save data from DataGridView into Database

    Private Sub updateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles updateButton.Click
        Me.Validate()
        Me.myDA.Update(Me.myDataSet.Tables("MyTable"))
        Me.myDataSet.AcceptChanges()
    End Sub

Hope this helps! :)


please help me guys
Me.myDA
and
Me.myDataSet

giving error helps? what else do i need to add
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,746
Location
Sydney, Australia
Programming Experience
10+
please help me guys
Me.myDA
and
Me.myDataSet

giving error helps? what else do i need to add

What do you think 'myDA' and 'myDataSet' represent?
 

Latest posts

Top Bottom