Hi,
All.

Actually i m creating a program using C# which connects to the database (oracle) and checks for the given table "OPC_GROUP". if the table doesnt exists then it creates the table
else it updates all field with provided values

I used following command to query

cmd.CommandText = "SELECT tname from tab where tname = 'OPC_GROUP'";

cmd.CommandType = CommandType.Text;            
            int length = cmd.ExecuteNonQuery();
if (cmd.ExecuteNonQuery() >0)
            {
                MessageBox.Show("Table does exist");
            }
            else
                MessageBox.Show("Table doesnt exist");

But this code return "TABLE DOESNT EXIST" though table is already created

What i m doing wrong:( :'(

Please help.......... Thnx in advance

Attached is my solution made in vs2005

Dont run the query twice?
You have your code in a transaction, Im guessing it doesnt return the answer you want as the transaction doesnt close..

(Dont have an oracle to hand to test)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.