I am new to C#, and making a form which creates buttons from database stored values. I already have image stored in the table,i don't know how to add image this way
Here is the code
SqlDataAdapter adapt = new SqlDataAdapter("select * from Items order by name", sc);
DataTable dt = new DataTable();
adapt.Fill(dt);
for (int i = 0; i < dt.Rows.Count; i++)
{
Button btn = new Button();
btn.Name = "btn" + dt.Rows[i][1];
btn.Tag = dt.Rows[i][2];
btn.BackgroundImage = dt.Rows[i][5];
btn.Text = dt.Rows[i][1].ToString();
btn.Font = new Font("Arial", 12f, FontStyle.Bold);
btn.Height = 60;
btn.Width = 120;
flowLayoutPanel1.Controls.Add(btn);
}
this error occurs
Error 5 Cannot implicitly convert type 'object' to 'System.Drawing.Image'. An explicit conversion exists (are you missing a cast?)