Update specific rows in LINQ to SQL result set.

Posted by davemackey on Stack Overflow See other posts from Stack Overflow or by davemackey
Published on 2010-04-06T21:32:29Z Indexed on 2010/04/07 4:13 UTC
Read the original article Hit count: 300

Filed under:
|

I have a page with a form on it and needs a range of dates. Thus I've placed a number of textboxes on the page into which users can type dates. When the user clicks the save button I want to trigger a LINQ update to the SQL Server...all the rows already exist, so I'm just updating existing data. How can I do this? For example, lets say my table looks like this:

Column Names: Description dateValue
Column Values:
               Birthdate   1/1/1990
               Anniversary 1/10/1992
               Death       1/1/1993

I want to do something like this:

hupdate.Description("Birthdate").dateValue = TextBox1.Text
hupdate.Description("Anniversary").dateValue = TextBox2.Text
hupdate.Description("Death").dateValue = TextBox3.Text
hconfig.SubmitChanges()

Is there a way to do this with LINQ?

© Stack Overflow or respective owner

Related posts about linq-to-sql

Related posts about vb.net