hi! currently i have the code below that query the max number in my id_number column but it walys gives me an error maybe i just Dont know how to check the return value of the query..can you help me guys here..thanks!
Code:
        public int get_maxid()
        {
            int return_value;
            if (db_connection())
            {
                string qryStr = "Select Max(id_number) from docs_ref";
                OracleCommand OraCmd = new OracleCommand(qryStr, OraConn);
                object result = OraCmd.ExecuteOracleScalar();
                MessageBox.Show("Result:" + result.ToString());
                if (result is int)//if it returns the max value for my id_number column
                {
                    return_value = (int)result;
                }
                else
                {
                   //id_number column has no rows/value
                    return_value = 0;
                }
                OraCmd.Connection.Close();
                OraConn.Close();
            }
            else
            {
                //error in my Database Connection
                return_value = -1; 
            }
            return return_value;
        }
by the way, my database is Oracle 10g.