[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


How to save changes from a datagridview to a SQL Server 2008 database using Linq to SQl

Posted on 2011-10-06
Medium Priority
Last Modified: 2012-08-14
I have a VS 2010 windows form application, where the user can edit/add new rows into a datagridview. I use Linq to SQL to populate the datagridview with the existing data from the database. My question is when the user clicks on the Save button, how do I write the changes and/or new data entered back to the database, using Linq to SQL?

Below is the c# code I use to populate the datagridview.
OperationsDataContext opDC = new OperationsDataContext();

                dgTime.DataSource = opDC.Tasks_GetByProjectIDAndWeekEndingDate(Convert.ToInt32(cboTimeProject.SelectedValue), dtWeekEnding.Value);


Open in new window

Question by:jjliu4492
  • 2
LVL 26

Expert Comment

by:Anurag Thakur
ID: 36929681

Accepted Solution

jjliu4492 earned 0 total points
ID: 36932001

Author Closing Comment

ID: 36954282
I found the solution using google.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

872 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