How do I insert an image into the database?

In the ASPX page, have a asp:FileUpload control and a Submit button. On clicking the submit button, the following code inserts into the table - Image and column - ImageStream, of type varbinary


<asp:FileUpload ID="fup" runat="server" />
<asp:Button ID="btnSubmit" runat="server" Text="Hello" OnClick="btnSubmit_Click" />


protected void btnSubmit_Click(object sender, EventArgs e)
{
    byte [] bytes = fup.FileBytes;

    SqlConnection conn = new SqlConnection("Data Source=localhost; Database=Pubs; Integrated Security=true;");
    conn.Open();
    string sql = "INSERT INTO IMAGE (ImageStream) VALUES (@bytes)";
    SqlCommand comm = new SqlCommand(sql, conn);
    comm.Parameters.AddWithValue("@bytes", bytes);
    comm.ExecuteNonQuery();

}