コード例 #1
0
        protected bool UpdateByCondition(string condition)
        {
            ChangePropertys.Remove(_AUTH_ID);
            if (ChangePropertys.Count == 0)
            {
                return(true);
            }

            StringBuilder sql = new StringBuilder();

            sql.AppendLine("UPDATE TAUTH_CODE SET");
            while (ChangePropertys.MoveNext())
            {
                sql.AppendFormat(" {0}{1}=:{1} ", (ChangePropertys.CurrentIndex == 0 ? string.Empty : ","), ChangePropertys.Current);
                AddParameter(ChangePropertys.Current, DataRow[ChangePropertys.Current]);
            }
            sql.Append(" WHERE AUTH_ID=:AUTH_ID");
            AddParameter(_AUTH_ID, DataRow[_AUTH_ID]);
            if (!string.IsNullOrEmpty(condition))
            {
                sql.AppendLine(" AND " + condition);
            }
            bool result = base.UpdateBySql(sql.ToString());

            ChangePropertys.Clear();
            return(result);
        }
コード例 #2
0
        protected bool UpdateByCondition(string condition)
        {
            //移除主键标记
            ChangePropertys.Remove(_currency_id);

            if (ChangePropertys.Count == 0)
            {
                return(true);
            }

            StringBuilder sql = new StringBuilder();

            sql.AppendLine("update tmp_currency set");
            while (ChangePropertys.MoveNext())
            {
                sql.AppendFormat(" {0}{1}=?{1} ", (ChangePropertys.CurrentIndex == 0 ? string.Empty : ","), ChangePropertys.Current);
                AddParameter(ChangePropertys.Current, DataRow[ChangePropertys.Current]);
            }
            sql.AppendLine(" where currency_id=?currency_id");
            AddParameter(_currency_id, DataRow[_currency_id]);
            if (!string.IsNullOrEmpty(condition))
            {
                sql.AppendLine(" and " + condition);
            }

            bool result = base.UpdateBySql(sql.ToString());

            ChangePropertys.Clear();
            return(result);
        }