DataReader has rows but no Data?
Posted on 2006-06-22
I'm using an MS access database to store data for a program but when I go and try to receive data from the database via the code snippet below. When it get's to reading the data (in the line with the "*No Data*" label the following exception is thrown "No data exists for the row/column." with a source of "System.Data"
How can that happen when the HasRows' property checks to see if there is data there or not?
OleDbCommand cmd = new OleDbCommand("SELECT * FROM Country WHERE NationID ='"+name+"';", conn);
OleDbDataReader data = cmd.ExecuteReader();
numAirforce.Value = data.GetDecimal(3); *No data*