title: DataReader.Read() always returns false
body: <p>I've been searching for hours now. I can't find anything helpful for my problem.
  The Read()-function always returns false. If I run the SQL-command with sqlplus I get this result:</p>
  
  <pre><code>   GERA_ID   GETY_BEZEICHNUNG
     ---------------------------
      100001   Blackberry
      100002   GSM
  </code></pre>
  
  <p>here's a simplified version of the code:</p>
  
  <pre><code>List&lt;Divice&gt; divices = new List&lt;Divice&gt;();
  
  using (OracleConnection connection = new OracleConnection(connectionString))
  {
      OracleCommand cmd = new OracleCommand("select gera_id, gety_bezeichnung from idc_geraet, idc_geraettyp where idc_geraettyp.gety_id = idc_geraet.gety_id and pers_id = 4711");
      cmd.Connection = connection;
  
      connection.Open();
      OracleDataReader reader = cmd.ExecuteReader();
      while(reader.Read()) //returns always false
      {
          Divice g = new Divice();
          g.gera_id = reader.GetDecimal(0);
          g.gety_bezeichnung = reader.GetString(1);
          divices.Add(g);
      }
      reader.Close();
  }
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>This Code is called before. and it works fine:</p>
  
  <pre><code>IDC_PERSON p = new IDC_PERSON();
  using (OracleConnection connection = new OracleConnection(connectionString))
      {
          OracleCommand cmd = new OracleCommand("select PERS_VNAME, PERS_NNAME, PERS_EINTRDATUM from idc_person where PERS_ID = 4711");
          cmd.Connection = connection;
  
          connection.Open();
          OracleDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
          if (reader.Read())
          {
              p.PERS_ID = user_id;
              p.PERS_VNAME = reader.GetString(0);
              p.PERS_NNAME = reader.GetString(1);
              p.PERS_EINTRDATUM = reader.GetDateTime(2);
          }
          reader.Close();
      }
  </code></pre>
  
  <p>So, here is the whole code:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using System.Web.Mvc;
  using Oracle.DataAccess.Client;
  using TelKoOpt.Models;
  using System.Data;
  
  namespace TelKoOpt.Controllers
  {
      public class HomeController : Controller
      {
          string connectionString = "user id=scott;password=tiger;" +
                  "data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)" +
                  "(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=orcl)))";
          public ActionResult Index(int user_id)
          {
              MyDbContext dbcontext = new MyDbContext();
              IDC_PERSON p = new IDC_PERSON();
              List&lt;IDC_GERAET&gt; geraete = new List&lt;IDC_GERAET&gt;();
              List&lt;TELGSMEGN&gt; telgsmegn = new List&lt;TELGSMEGN&gt;();
              dbcontext.pers = p;
              dbcontext.geraete = geraete;
              dbcontext.telgsmegn = telgsmegn;
  
              using (OracleConnection connection = new OracleConnection(connectionString))
              {
                  OracleCommand cmd = new OracleCommand("select PERS_VNAME, PERS_NNAME, PERS_EINTRDATUM from idc_person where PERS_ID = " + user_id);
                  //OracleCommand cmdTelg = new OracleCommand("select service, sum(betrag), sum(dauer), sum(anzahl), zonen from test_telgsmegn where gera_id = " + user_id + " and datumaktion between '" + "01.02.2012" + "' and '" + "20.03.2012" + "' group by service, zonen; ");
                  cmd.Connection = connection;
                  //cmdTelg.Connection = new OracleConnection(connectionString);
  
                  try
                  {
                      connection.Open();
                      OracleDataReader reader = cmd.ExecuteReader();
                      if (reader.Read())
                      {
                          p.PERS_ID = user_id;
                          p.PERS_VNAME = reader.GetString(0);
                          p.PERS_NNAME = reader.GetString(1);
                          p.PERS_EINTRDATUM = reader.GetDateTime(2);
                      }
                      reader.Close();
                  }
                  catch (OracleException)
                  {
                      //return View(dbcontext);
                  }
              }
              using (OracleConnection connection = new OracleConnection(connectionString))
              {
                  OracleCommand cmd = new OracleCommand("select gera_id, gety_bezeichnung from idc_geraet, idc_geraettyp where idc_geraettyp.gety_id = idc_geraet.gety_id and pers_id = " + user_id);
                  cmd.Connection = connection;
  
                  try
                  {
                      connection.Open();
                      OracleDataReader reader = cmd.ExecuteReader();
                      while(reader.Read()) 
                      {
                          IDC_GERAET g = new IDC_GERAET();
                          g.gera_id = reader.GetDecimal(0);
                          g.gety_bezeichnung = reader.GetString(1);
                          geraete.Add(g);
                      }
                      reader.Close();
                  }
                  catch (OracleException)
                  {
                      //return View(dbcontext);
                  }
              }
              return View(dbcontext);
          }
      }
  }
  </code></pre>