/// <summary> /// 异步执行 /// </summary> /// <param name="commandText">SQL语句</param> /// <param name="commandParameters">参数集合</param> /// <param name="transaction">使用指定的事务处理</param> /// <param name="commandType">SQL语句 | 存储过程</param> /// <returns>受影响行数</returns> #else /// <summary> /// async ExecuteNonQuery /// </summary> /// <param name="commandText">SQL statement</param> /// <param name="commandParameters">SqlParameter Collection</param> /// <param name="transaction">transaction</param> /// <param name="commandType">Text | StoredProcedure</param> /// <returns>the affected rows</returns> #endif public static async Task <int> ExecuteNonQueryAsync(string commandText, SqlParameter[] commandParameters, MicroDBTransaction transaction, CommandType commandType = CommandType.Text) { if (transaction == null) { throw new InvalidOperationException(ERRMSG_TRANSACTION_IS_NULL, new ArgumentNullException("transaction")); } return(await AsyncSQLHelper.ExecuteNonQueryAsync(transaction.tran, commandType, commandText, commandParameters)); }
/// <summary> /// 异步执行 /// </summary> /// <param name="commandText">SQL语句</param> /// <param name="commandParameters">参数集合</param> /// <param name="commandType">SQL语句 | 存储过程</param> /// <param name="connectionAliasName">连接别名;如果没起别名,则使用默认的连接字符串</param> /// <returns>受影响行数</returns> #else /// <summary> /// async ExecuteNonQuery /// </summary> /// <param name="commandText">SQL statement</param> /// <param name="commandParameters">SqlParameter Collection</param> /// <param name="commandType">Text | StoredProcedure</param> /// <param name="connectionAliasName">the Alias Name of Connection (if not pass name,it will use the DEFAULT name instead.)</param> /// <returns>the affected rows</returns> #endif public static async Task <int> ExecuteNonQueryAsync(string commandText, SqlParameter[] commandParameters, string connectionAliasName = ALIAS_NAME_DEFAULT, CommandType commandType = CommandType.Text) { return(await AsyncSQLHelper.ExecuteNonQueryAsync(GetConnection(connectionAliasName), commandType, commandText, commandParameters)); }