Hi everyone. I am selecting a column from a table which returns a field with a number. I wish to return this number to an integer in c# so that I can increment the integer by 1 after getting it. I am using visual studio 2010,C# and oracle as my database
This is my code: **Hi guys. I tried as you told me but it did not work. It is crashing--+ $exception {"Unable to cast object of type 'Oracle.DataAccess.Client.OracleDataReader' to type 'System.IConvertible'."} System.Exception {System.InvalidCastException}
**
public static int GetRunNumber(string date)
{
int result;
DatabaseAdapter dba = DatabaseAdapter.GetInstance();
string sqlQuery = "SELECT RUN FROM LOAD_CONTROL " +
"WHERE START_DATE = (SELECT MAX(START_DATE) " +
"FROM LOAD_CONTROL " +
"WHERE LOAD_DATE = to_date('" + date + "', 'dd/mm/yyyy')) " +
"AND LOAD_DATE = to_date('" + date + "', 'dd/mm/yyyy') ";
result = Convert.ToInt32(dba.QueryDatabase(sqlQuery));
return result;
}