0

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

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by LizR
0

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)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.