Solved

Update database from datagridview

Posted on 2014-02-06
4
249 Views
Last Modified: 2014-02-09
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?
0
Comment
Question by:TimHudspith
  • 2
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
ktaczala earned 500 total points
ID: 39840940
dataadpater.update()

where dataadapter is whatever you named yours
0
 

Author Comment

by:TimHudspith
ID: 39840942
which event of the datagridview?
0
 
LVL 12

Expert Comment

by:ktaczala
ID: 39840975
Create a save button
0
 

Author Comment

by:TimHudspith
ID: 39843852
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

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now