title: Cannot convert type 'string' to 'byte[]'?
body: <p>Hi I have to display student image on image box while selecting  student ID from drop down list. The image is store in binary format in db.I want to display the image without using generic http handler. While using the given below code generation one error. The error is "Cannot convert type string to byte[]". Please help me.</p>
  
  <p>Code:</p>
  
  <pre><code>protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
  {
      DataSet1TableAdapters.TextBoxTableTableAdapter tx;
      tx = new DataSet1TableAdapters.TextBoxTableTableAdapter();
      DataTable dt = new DataTable();
      dt = tx.GetstudData(int.Parse(DropDownList1.SelectedValue));
      foreach (DataRow row in dt.Rows)
      {
          TextBox1.Text = (row["FirstName"].ToString());
          TextBox2.Text = (row["SecondName"].ToString());  
          byte[] barrImg = (byte[])(row["StudImage"].ToString());
          string base64String = Convert.ToBase64String(barrImg , 0, barrImg.Length);
          Image1.ImageUrl = "data:image/png;base64," + base64String;
      }
  }
  </code></pre>
  
  <p>SQL Query:</p>
  
  <pre><code>SELECT FirstName, SecondName, StudentImage FROM TextBoxTable WHERE (Id = @Id)
  </code></pre>
  
  <p>Aspx Source:</p>
  
  <pre><code>&lt;div&gt;
  &lt;asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"&gt;
  &lt;asp:TextBox ID="TextBox1" runat="server"&gt;&lt;/asp:TextBox&gt;
  &lt;asp:TextBox ID="TextBox2" runat="server"&gt;&lt;/asp:TextBox&gt;
  &lt;asp:Image ID="Image1" runat="server" /&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Data Base:</p>
  
  <p><img src="https://i.stack.imgur.com/xdVrl.jpg" alt="enter image description here"></p>