项目中用到的关于时间段不能重复的解决方法

新建时:

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 + "'";
编辑时:
 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 + "'";
           
 
posted @ 2009-09-08 18:19  goldkevin  阅读(241)  评论(0编辑  收藏  举报