AccessProviderSample.AccessDBProvider.GetRow C# (CSharp) Method

GetRow() private method

Retrieves a single row from the named table.
private GetRow ( string tableName, int row ) : DatabaseRowInfo
tableName string The table that contains the /// numbered row.
row int The index of the row to return.
return DatabaseRowInfo
        private DatabaseRowInfo GetRow(string tableName, int row)
        {
            Collection<DatabaseRowInfo> di = GetRows(tableName);

            // if the row is invalid write an appropriate error else return the
            // corresponding row information
            if (row < di.Count && row >= 0)
            {
                return di[row];
            }
            else
            {
                WriteError(new ErrorRecord(
                   new ItemNotFoundException(),
                   "RowNotFound",
                   ErrorCategory.ObjectNotFound,
                   row.ToString(CultureInfo.CurrentCulture))
                );
            }

            return null;
        }