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); }
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); }