Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Displaying list of tables in Oracle DB in comboBox

Author  Topic 

tommy_liang
Starting Member

1 Post

Posted - 2009-02-12 : 01:26:14
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."

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.
   

- Advertisement -