Without using loops this can be done:
var IDs = @"1,2,3,4,5,6";
var IDarray = IDs.Split(",");
var toDelete = from T in db.Table
where IDarray.Contains(T.ID)
select T;
db.Table.DeleteAllOnSubmit(toDelete);
db.SubmitChanges();
Unfortunately this results in six delete commands on the server, so it isn't as efficient as a single SQL delete command. Other people have been developing extensions to LINQ for deletes and updates which you could try out. See Aney's blog[^] or Zhao's blog[^] for more info.
'Howard
modified on Saturday, August 9, 2008 10:59 AM