Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Update database from datagridview

Posted on 2014-02-06
4
Medium Priority
?
268 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

715 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