DevTreks.Data/Helpers/SqlIOAsync.cs
/// <summary>
/// Run 2 stored procedures using same command (so that a row count and sqldatareader can be used).
/// </summary>
/// <param name="procName">Name of stored procedure.</param>
/// <param name="prams">Stored procedure parameters.</param>
/// <param name="dataReader">Return result of procedure.</param>
Run 2 stored procedures using same command (so that a row count and sqldatareader can be used).
Run 2 stored procedures using same command ( so that a row count and sqldatareader can be used ) .
public async Task<SqlDataReader> Run2ProcAsync(string procName, 
            SqlParameter[] prams, int outputPramPosition)
        {
            int rowCount = 0;
            SqlCommand cmd = await CreateCommandAsync(procName, prams);
            System.Object oReturnFirstRowColumn = cmd.ExecuteScalar();
            if (prams[outputPramPosition].Value != System.DBNull.Value) rowCount = (int)prams[outputPramPosition].Value;
            SqlDataReader dataReader 
                = await cmd.ExecuteReaderAsync();
            return dataReader;
        }
public async Task < SqlDataReader > Run2ProcAsync ( string procName , SqlParameter [ ] prams , int outputPramPosition ) { int rowCount = 0 ; SqlCommand cmd = await CreateCommandAsync ( procName , prams ) ; System . Object oReturnFirstRowColumn = cmd . ExecuteScalar ( ) ; if ( prams [ outputPramPosition ] . Value != System . DBNull . Value ) rowCount = ( int ) prams [ outputPramPosition ] . Value ; SqlDataReader dataReader = await cmd . ExecuteReaderAsync ( ) ; return dataReader ; }
Run 2 stored procedures using same command (so that a row count and sqldatareader can be used).
Run 2 stored procedures using same command ( so that a row count and sqldatareader can be used ) .
//find a way to return row count too // make sure connection is open //used to get the row count //used to get the sqldatareader
procName
string
Name of stored procedure.
Name of stored procedure .
prams
SqlParameter[]
Stored procedure parameters.
Stored procedure parameters .
outputPramPosition
int
dataReader
Return result of procedure.
Return result of procedure .