Update database from datagridview

On a form I have a datagridview bound to a table in a SQL Server database. When I make edits to the data in the DGV the changes are not being written back to the database. How do I do it?
TimHudspithAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
ktaczalaConnect With a Mentor Commented:
dataadpater.update()

where dataadapter is whatever you named yours
0
 
TimHudspithAuthor Commented:
which event of the datagridview?
0
 
ktaczalaCommented:
Create a save button
0
 
TimHudspithAuthor Commented:
This works, but only if I create a SqlCommandBuilder first.

Using cmdbl As SqlCommandBuilder = New SqlCommandBuilder(dap)
         dap.Update(tblGridSource)
End Using

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.