0

我有一个 SQL 表,我想使用 SilverLight Linq-to-SQL 删除一行。我是 Linq-to-SQL 的新手,但 SQL 语句应该是

DELETE FROM Lloyds_Selection_Vessel WHERE Selection_ID == inpSelectionID AND ImoNumber == inpImoNumber

什么是 Linq-to-SQL 语句?这是我的代码:

[OperationContract]
void DeleteSelectionVesselRow(int inpSelectionID, int inpImoNumber)
{
    PositionDataClassesDataContext context = new PositionDataClassesDataContext();

    context.Lloyds_Selection_Vessels.DeleteAllOnSubmit(context.Lloyds_Selection_Vessels.Where(l => l.Selection_ID == inpSelectionID && x => x.ImoNumber == inpImoNumber));
    context.SubmitChanges();
}

桌子:

在此处输入图像描述

4

1 回答 1

1

您的 LINQ Where 函数不应该改为: .Where(l => l.Selection_ID == inpSelectionID && l.ImoNumber == inpImoNumber) 吗?

于 2013-03-14T15:29:50.947 回答