예제 #1
0
        /// <summary>
        /// 根据主键值数组删除记录
        /// </summary>
        /// <param name="T">实体类对象</param>
        /// <param name="value">要删除的主键值数组</param>
        public override void Delete(string PK, string tableName, List <string> value)
        {
            base.Delete(PK, tableName, value);
            StringBuilder sbColumnName       = new StringBuilder();
            StringBuilder sbValues           = new StringBuilder();
            StringBuilder sbUpdateWhere      = new StringBuilder();//Where 条件
            List <string> lisParameter       = new List <string>();
            List <object> lisParameterValues = new List <object>();

            //Where条件 主键的值(必须有主键)。
            sbUpdateWhere.Append(_Transfer_B);
            sbUpdateWhere.Append(PK);
            sbUpdateWhere.Append(_Transfer_E);
            sbUpdateWhere.Append("IN");
            sbUpdateWhere.Append("(");
            for (int i = 0; i < value.Count; i++)
            {
                if (i != 0)
                {
                    sbUpdateWhere.Append(",");
                }
                sbUpdateWhere.Append(_VariableC + PK + "_" + i.ToString());
                lisParameter.Add(_VariableC + PK + "_" + i.ToString());
                lisParameterValues.Add(value[i]);
            }
            sbUpdateWhere.Append(")");
            Delete DeleteSql = new Delete(true, base._FrontTableName, base._TableName, sbUpdateWhere);
            int    iResult   = ExecuteSql.ExeParaSqlForNonQueryAccess(DeleteSql.ConnectDeleteString(), lisParameter, lisParameterValues);
        }