0

SQLテーブルがあり、SilverLightLinq-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 に答える