Пример #1
0
 public sCondition(string fName, string fValue, string sSign, FieldType fType, JoinSign sJoinSign)
 {
     _FieldName  = fName;
     _FieldValue = fValue;
     _FieldType  = fType;
     _Sign       = sSign;
     _JoinSign   = sJoinSign;
 }
Пример #2
0
 private string GetJoinSign(JoinSign sJoinSign)
 {
     if (sJoinSign == JoinSign.OR)
     {
         return(" OR ");
     }
     else
     {
         return(" AND ");
     }
 }
Пример #3
0
        /// <summary>
        /// 添加SQL语句条件字段 Like 条件
        /// </summary>
        /// <param name="FieldName">字段名称</param>
        /// <param name="FieldValue">字段类型</param>
        /// <param name="JoinSign">条件</param>
        public void AddLikeCondition(string FieldName, string FieldValue, JoinSign JoinSign)
        {
            if (string.IsNullOrEmpty(FieldName))
            {
                return;
            }
            if (string.IsNullOrEmpty(FieldValue))
            {
                return;
            }
            sCondition newCondition = new sCondition(FieldName, FieldValue, " like ", FieldType.STR, JoinSign);

            _SqlCondition.Add(newCondition);
        }
Пример #4
0
 /// <summary>
 /// 添加SQL语句条件字段
 /// </summary>
 /// <param name="FieldName">字段名称</param>
 /// <param name="FieldValue">条件值</param>
 /// <param name="FieldType">字段类型</param>
 /// <param name="JoinSign">条件</param>
 public void AddCondition(string FieldName, object FieldValue, FieldType FieldType, JoinSign JoinSign)
 {
     if (FieldValue == null)
     {
         return;
     }
     AddCondition(FieldName, FieldValue.ToString(), " = ", FieldType, JoinSign.AND);
 }
Пример #5
0
        /// <summary>
        /// 添加SQL语句条件字段
        /// </summary>
        /// <param name="FieldName">字段名称</param>
        /// <param name="FieldValue">条件值</param>
        /// <param name="Sign">文本格式条件,如“>,=,<”</param>
        /// <param name="FieldType">字段类型</param>
        /// <param name="JoinSign">条件</param>
        public void AddCondition(string FieldName, string FieldValue, string Sign, FieldType FieldType, JoinSign JoinSign)
        {
            if (string.IsNullOrEmpty(FieldName))
            {
                return;
            }
            if (string.IsNullOrEmpty(FieldValue))
            {
                return;
            }
            if (string.IsNullOrEmpty(Sign))
            {
                Sign = " = ";
            }
            sCondition newCondition = new sCondition(FieldName, FieldValue, Sign, FieldType, JoinSign);

            _SqlCondition.Add(newCondition);
        }