Solved

Update database from datagridview

Posted on 2014-02-06
4
246 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
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 shrink a transaction log file down to a reasonable size.

747 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

12 Experts available now in Live!

Get 1:1 Help Now