c# - Invalid attempt to read - Is possible using Action? -
public void executeaction(mysqlcommand query, action<mysqldatareader> action) { _connection.open(); query.connection = _connection; using(var reader = query.executereader()) { while (reader.read()) { action(reader); } reader.close(); } _connection.close(); } is possible this? getting error "invalid attempt read when reader closed". this piece of code i'm using: private void updaterecords() { var query = string.format("select * {0}", _table); var cmd = new mysqlcommand(query); _db.executeaction(cmd, reader => { var rows = new list<object>(); (var = 0; < reader.fieldcount; i++) { if (reader.isdbnull(