删除所有记录的最佳方法? [英] BEST method TO delete all record?
本文介绍了删除所有记录的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的表格
i have table like this
Id Employee_Id Sector_Id Date
1 xxx kkk 2015-12-15
1 sss ddd 2015-12-15
1 fff nnn 2015-12-15
i想删除所有基于sector_Id和给定日期的记录??
i有搜索谷歌但是没有办法一次删除所有记录
i我正在使用此代码
i want to delete all records base on sector_Id and given date??
i have search google but there is no method to delete all record at once
i am using this code
var deleteRecord1 = _service.GetAllDutyPointStatus().Where(x => x.Date == dt && x.Sector_Id == sectorId).Count();
if (deleteRecord1 != null)
{
_service.DeleteDutyPointStatus(deleteRecord1);
}
else
{
MsgLitteral.ShowNotificationInline("No Record Found!.", true);
}
推荐答案
实现所需内容的最简单方法是使用以下SQL根据您的过滤条件删除所有记录。
The easiest way to acheive what you want is to use following SQL to delete all records based on your filter criteria.
DELETE FROM <table_name>
WHERE SECTOR_ID = <sector_id>
AND DATE = <date></date></sector_id></table_name>
上面将删除TABLE_NAME中具有日期的特定sector_id的所有记录。
Above will delete all records in TABLE_NAME of specific sector_id with Date.
这篇关于删除所有记录的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文