jjliu4492
asked on
How to save changes from a datagridview to a SQL Server 2008 database using Linq to SQl
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.
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);
dgTime.AutoResizeColumns();
TimeEntryScreen.png
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
I found the solution using google.
http://channel9.msdn.com/Blogs/funkyonex/Amanda-Silver-on-Visual-Basic-LINQ-Syntax-in-Visual-Studio-2008