任何帮助都非常感谢,伙计们。我尝试使用数据集和其他解决方案无济于事。我一直得到的错误是“参数无效”。我的代码是这样的:
try
{
conn.Open();
MySqlCommand comm = new MySqlCommand("SELECT lastname, firstname, picture FROM casestudyprofile WHERE caseid = " + id, conn);
MySqlDataAdapter adp = new MySqlDataAdapter(comm);
DataTable dt = new DataTable();
adp.Fill(dt);
if (dt.Rows.Count > 0)
{
lblname.Text = dt.Rows[0]["firstname"].ToString() + " " + dt.Rows[0]["lastname"].ToString();
pbox2.Image = Image.FromStream(new MemoryStream((byte[])dt.Rows[0]["picture"]));
}
conn.Close();
}