Skip to content

Displaying list of tables in Oracle DB in comboBox

tommy

Asked Feb 11, 2009, 12:46 AM EST2 answers
Share
LinkedInX

Hi I'm currently trying to display All the Tables in the Oracle database.But this exception error keep blocking me...

"System.InvalidOperationException: Operation is not valid due to the current state of the object."

Java
try
            {
                localSQL = "SELECT table_name FROM user_tables";
                OracleCommand cmdOracle = new OracleCommand(localSQL, localConnection);
                cmdOracle.CommandType = CommandType.Text;
                OracleDataReader drOracle = cmdOracle.ExecuteReader();
                while (drOracle.Read())
                {
                    tablelistBox.Items.Add(drOracle.GetOracleValue(0).ToString());
                }
            }

I've tried SELECT table_name FROM user_tables in the Oracle and it does generate the list of tables...but somehow this code does'nt work.

Any help or advice is appreciated.

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    tablelistBox.Items.Insert(drOracle.GetOracleValue(0).ToString()); try like this
    0
  • 0
    Once i changed Add to Insert the compliation error of  "No overload method 'Insert' takes '1' arguments"
    0