title: Error adding from database to dropdownlist
body: <p>I have a panel that is visible only when the Edit button from <code>GridView</code> is clicked.</p>
  
  <p>In that panel is a form with a <code>DropDownList</code> and a <code>TextBox</code> where you can write a number and add it to a <code>ListBox</code>. </p>
  
  <p>After all the numbers wanted are added to the <code>ListBox</code> when I click the button Finalize is adding to the database the data. In <code>Gridview</code> I have the name concatenate from database , because I have Lastname and Firstname separately. </p>
  
  <p>To be more easy I chose to add from database in <code>DropDownList</code> when I click on Edit button with the specific ID. </p>
  
  <p>When Edit button is clicked this error is showing:</p>
  
  <blockquote>
    <p>Operation is not valid due to the current state of the object.</p>
  </blockquote>
  
  <p>In the line where I add in <code>DropDownList</code>. I verified the names of my database, of my table , all and is correct. I even tried only with firstname , not concatenate and it does the same error. I don't know what is wrong. I hope you can help me. This is the code where the error appears.</p>
  
  <pre><code>protected void btnEditSO_Click(object sender, EventArgs e)
  {
      panelSO.Visible = true;
      btnFinalizeSO.Text = " Update ";
  
      Button but = (Button)sender;
      GridViewRow grid = (GridViewRow)but.NamingContainer;
  
      string select_sql_SOddl = "SELECT ID, (LASTNAMER | | ' ' | | FIRSTNAMER ) AS REFERENTNAME FROM REFERENT_SHIPPING WHERE ID=" + grid.Cells[14].Text;
  
      using (OracleConnection con = new OracleConnection(ConfigurationManager.ConnectionStrings["DBCS"].ToString()))
      {
          con.Open();
  
          OracleCommand cmd1 = new OracleCommand(select_sql_SOddl, con);
  
          OracleDataReader dr1 = cmd1.ExecuteReader();
  
          while (dr1.Read())
          {
              ddlReferentShip.Items.Add(dr[0].ToString());
           // ddlReferentShip.Items.Add(dr["REFERENTNAME"].ToString());
           //   ddlReferentShip.DataSource = dr1;
          //    ddlReferentShip.DataTextField = dr1["REFERENTNAME"].ToString();
          //    ddlReferentShip.DataValueField = dr1["ID"].ToString();               
          //    ddlReferentShip.DataBind();
          }
  
      }
  
  }
  </code></pre>