这个方法应该是读取下一条数据。是吧?
它的返回值是表示读取是否成功,对吧?
请看:
MyDataNameSpace.MySqlCommand InsertCommand = new MyDataNameSpace.MySqlCommand(oracleConnection1);
InsertCommand.Open();
System.Data.OracleClient.OracleDataReader MaxReader = InsertCommand.ExecuteReader("select max(id) from mac_departmentcontrol");
Exception ora_err = new Exception("获取最大值未成功。");
long depcontrolmax; 
if(MaxReader.Read())
                  {
depcontrolmax = MaxReader.GetInt64(0);
Label1.Text = depcontrolmax.ToString();
}
else
{
throw(ora_err);
                                     }mac_departmentcontrol表中没有任何数据。那么应该读不出数据,是不是?
那为什么在if(MaxReader.Read())处没有弹出异常,反倒是其下一句depcontrolmax = MaxReader.GetInt64(0);处发生了错误呢?
错误信息是No data exists for the row or column.请大家帮忙解决,谢谢。