Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update in LINQ

Status
Not open for further replies.

sds814

Programmer
Feb 18, 2008
164
US
Just wondering how developers are working around the issue that LINQ doesn't have an update command.

I've been having it to do it in 2 commands:

1) select the items that meet the criteria
2) do a foreach on the items selected and set that criteria to the specified value.

for example,

Code:
IEnumerable<IDropDownItem> LdItems;
                    LdItems =
                    from ddList in loCheckCriteria.LobjList
                    select ddList;

                    foreach (IDropDownItem LdItem in LdItems)
                    {
                       LdItem.IsSelected = true;
}

thanks for the help
 
linq does provide the ability to update... here is an example....

Code:
var items = db.TableName.Single(i => i.id == 123);
items.ColumnName1 = "some value";
items.ColumnName2 = "some other value";
db.SubmitChanges();

Hope this helps.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top