with the first question i think you need to read a specific column from the reader according to a variable inserted (i hope i understood you)
i have attached a sample work with NorthWind DB just change the Connection String
I need to check the last value of that column , and see if it has exceeded its max value ( just a number ).
simple SQL Statement could do that in case that the column was identity column
/* Return The Last inserted Identity Value On Current Session */
/* Return The Last inserted Identity Value In ALL scopes And Sessions */
checks books online for that
i need to get a table name and column name from one table X and use this table name to get in to table Y and select there the column i got from table X