title: Deleting rows in a table with Linq to SQL
body: <p>I have a sports database with a table groupmembers which have the fields ID, groupID and memberID. I get the memberID from a textbox called txtRemoveGroupMember and the groupID from a checkboxlist. Now I want to delete the rows which have both the groupID and the memberID.
  I have tried this code:</p>
  <pre><code>foreach(ListItem listItem in cblRemoveMemberFromGroup.Items)
  {
         int memberid = Convert.ToInt32(txtRemoveGroupMember.Text);
         int groupid = Convert.ToInt32(listItem.Value);
  
         var removeFromGroup = from gm in dataContext.GroupMembers
              where (gm.memberID == memberid) &amp;&amp; (gm.groupID == groupid)
              select gm;
  
         dataContext.GroupMembers.DeleteOnSubmit(removeFromGroup);
         dataContext.SubmitChanges();
  }
  </code></pre>
  <p>But I get this error:</p>
  <blockquote>
  <p>Error 7 Argument 1: cannot convert from 'System.Linq.IQueryable&lt;GSI_side.GroupMember&gt;' to 'GSI_side.GroupMember'</p>
  </blockquote>
  <p>And this error:</p>
  <blockquote>
  <p>Error 6 The best overloaded method match for 'System.Data.Linq.Table&lt;GSI_side.GroupMember&gt;.DeleteOnSubmit(GSI_side.GroupMember)' has some invalid arguments</p>
  </blockquote>
  <p>Hope someone can help me figure this out!</p>