我有一个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();
}
表:
答案 0 :(得分:1)
你的LINQ Where函数不应该读: .Where(l => l.Selection_ID == inpSelectionID&& l.ImoNumber == inpImoNumber) 代替?