in

SharePoint Blogs

The Best Place for SharePoint-related Blogs

OBA, SharePoint and Aghy [MVP]

LINQ4SP - Delete a list item

OK, let's play with LINQ4SP again.

You can download Beta1, write a simple query, create a new list item and lookup fields. In the next part I'll show you how to delete an item from a list:

        [TestMethod]
public void DeleteCreatedItems()
{
using (AwContext context = new AwContext())
{
var q = from subCategory in context.ProductSubcategory
where subCategory.Title == "new sub category"
select subCategory;

foreach (ProductSubcategory psubcat in q) psubcat.DeleteOnSubmit();


var p = from product in context.Product
where product.ProductNumber == "AA" ||
product.ProductNumber == "Double test" ||
product.ProductNumber == "Date test"
select product;
foreach (Product prod in p) prod.DeleteOnSubmit();

var z = from pc in context.ProductCategory
where pc.Title == "new product category"
select pc;
foreach (ProductCategory prodcat in z) prodcat.DeleteOnSubmit();

context.Submit();
}
}

Comments

 

OBA, SharePoint and Aghy [MVP] said:

OK, let's play with LINQ4SP again. You can download Beta1 , write a simple query , create a new list

May 25, 2008 4:49 PM
 

Dew Drop - May 26, 2008 | Alvin Ashcraft's Morning Dew said:

Pingback from  Dew Drop - May 26, 2008 | Alvin Ashcraft's Morning Dew

May 26, 2008 8:57 AM
 

SharePoint MVP Blogs said:

OK, let's play with LINQ4SP again. You can download Beta1 , write a simple query , create a new list

June 19, 2008 10:02 AM

Leave a Comment

(required )  
(optional )
(required )  
Add

Need SharePoint Training? Attend a SharePoint Bootcamp!

Posts (c) their respective authors. Everything else (c) 2007 SharePoint Experts