My search in BD oracle does not work

0

I have a method, using Ado.Net to bring DB information (Oracle 11g). There is information in the table (6 records) and when I run it by C# no record comes. See the code below:

public class ConexaoBanco
    {
        string conexao = ConfigurationManager.ConnectionStrings["FarmExternaConnect"].ConnectionString;
        List<string> listaArquivoFarmExterna = new List<string>();
        public bool CriaConexao()
        {
            OracleConnection conn = new OracleConnection(conexao);
            conn.Open();

            OracleCommand cmd = new OracleCommand();
            cmd.Connection = conn;
            cmd.CommandText = "select path, arquivo from gh_arquivos_farm_externa";
            cmd.CommandType = CommandType.Text;

            OracleDataReader dr = cmd.ExecuteReader();

            while(dr.Read())
            {
                listaArquivoFarmExterna.Add(dr.ToString());
                //listaArquivoFarmExterna.Add(dr.GetString(1));
            }

            return listaArquivoFarmExterna.Count > 0? true : false;
        } 
    }

The most interesting thing about this is the following situation. When I get to this line OracleDataReader dr = cmd.ExecuteReader(); and give an F10 (in debug mode), I go forward and when debugging this line there is information (correct), but if I debug the variable dr in this line while(dr.Read()) , it says:

  

Enumeration did not produce results

And if I go back to the top row, where there are a few moments ago, I have the same message. I do not know what's going on.

    
asked by anonymous 18.03.2016 / 12:27

1 answer

0

I killed the problem. When I debugged, I triggered the read and as it does not return to read the fetch again, when arriving in the while already arrived without information. It was my fault

    
18.03.2016 / 12:58