示例#1
0
        public bool Delete(Where where) {
 
            using (SqlCommand command = new DbHelper().Command) {
                string sql = $"delete from {Table} where {where.Result};";
                return command.ExecuteNonQueryExt(sql, where) > 0;
            }
        }
示例#2
0
        public bool Update(Update update) {
            Dictionary<string, dynamic> dic = update.Dic;
            string where = update.WhereCore.Result;
            string fv = string.Join(",", dic.Select(pair => $"{pair.Key}=@{pair.Key}"));


            string sql = $"update {Table} set {fv} where {where};";
            using (SqlCommand command = new DbHelper().Command) {
                command.CommandText = sql;
                int ret = command.ExecuteNonQueryExt(sql, update);
                return ret > 0;
            }
        }