项目中用到的关于时间段不能重复的解决方法
新建时:
string sql = "select ShipperQuoteMasterNo from SEGShipperQuoteMaster where ShipperQuoteMasterNo not in ( select ShipperQuoteMasterNo "
+ "from SEGShipperQuoteMaster where CONVERT(varchar(10),QuoteEndDate,120)<'" + DataTypeHelper.GetDateTime(shipperQuoteMaster.QuoteStartDate).ToString("yyyy-MM-dd") + "' OR CONVERT(varchar(10),QuoteStartDate,120)>'" + DataTypeHelper.GetDateTime(shipperQuoteMaster.QuoteEndDate).ToString("yyyy-MM-dd") + "' ) and ShipperID='" + shipperQuoteMaster.ShipperID + "'";
编辑时:+ "from SEGShipperQuoteMaster where CONVERT(varchar(10),QuoteEndDate,120)<'" + DataTypeHelper.GetDateTime(shipperQuoteMaster.QuoteStartDate).ToString("yyyy-MM-dd") + "' OR CONVERT(varchar(10),QuoteStartDate,120)>'" + DataTypeHelper.GetDateTime(shipperQuoteMaster.QuoteEndDate).ToString("yyyy-MM-dd") + "' ) and ShipperID='" + shipperQuoteMaster.ShipperID + "'";
string sql = "select ShipperQuoteMasterNo from SEGShipperQuoteMaster where ShipperQuoteMasterNo not in ( select ShipperQuoteMasterNo "
+ "from SEGShipperQuoteMaster where CONVERT(varchar(10),QuoteEndDate,120)<'" + DataTypeHelper.GetDateTime(shipperQuoteMaster.QuoteStartDate).ToString("yyyy-MM-dd")
+ "' OR CONVERT(varchar(10),QuoteStartDate,120)>'" + DataTypeHelper.GetDateTime(shipperQuoteMaster.QuoteEndDate).ToString("yyyy-MM-dd") + "' ) and ShipperID='" + shipperQuoteMaster.ShipperID + "' and ShipperQuoteMasterNo<>'" + shipperQuoteMaster.ID + "'";
+ "from SEGShipperQuoteMaster where CONVERT(varchar(10),QuoteEndDate,120)<'" + DataTypeHelper.GetDateTime(shipperQuoteMaster.QuoteStartDate).ToString("yyyy-MM-dd")
+ "' OR CONVERT(varchar(10),QuoteStartDate,120)>'" + DataTypeHelper.GetDateTime(shipperQuoteMaster.QuoteEndDate).ToString("yyyy-MM-dd") + "' ) and ShipperID='" + shipperQuoteMaster.ShipperID + "' and ShipperQuoteMasterNo<>'" + shipperQuoteMaster.ID + "'";