Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Update database from datagridview

Posted on 2014-02-06
4
Medium Priority
?
270 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 13

Accepted Solution

by:
ktaczala earned 1500 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 13

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

885 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