I want know if sql statement is a select, and for this I use ExecuteNonQuery() command, because for UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. For all other types of statements, the return value is -1.
OracleConnection con=null;
try
{
string sql = "select * from cl_funcionario";
con = new OracleConnection("User Id=scott;Password=tiger;SID=ORCL;Direct=true;Server=localhost");
OracleCommand cmd = new OracleCommand(sql, con);
cmd.Connection.Open();
cmd.CommandType = CommandType.Text;
int ret = cmd.ExecuteNonQuery();
}
finally
{
con.Close();
}
ret should have -1 by ret=0