Пример #1
0
        /// <summary>
        /// SqlBulkCopy批量提交数据[复制]
        /// </summary>
        /// <typeparam name="T">表实体类</typeparam>
        /// <param name="modelList">列表实体</param>
        /// <returns></returns>
        public static void SqlBulkCopy <T>(List <T> modelList)
        {
            DataTable dataTable = ModelUtil.ModelList2DataTable <T>(modelList);

            DbHelperSQL.SqlBulkCopyByDataTable(dataTable.TableName, dataTable);
        }
Пример #2
0
        /// <summary>
        /// SqlDataAdapter批量更新
        /// </summary>
        /// <typeparam name="T">表实体类</typeparam>
        /// <param name="modelList">列表实体</param>
        /// <returns>返回更新影响的行数</returns>
        public static int BatchUpdate <T>(List <T> modelList)
        {
            DataTable dataTable = ModelUtil.ModelList2DataTable <T>(modelList);

            return(DbHelperSQL.BatchUpdate(dataTable.TableName, dataTable));
        }