帮忙查错啊:图片的存取
if(dataSet1.Tables["employees"] .Rows[i]["照片"].ToString()!="")
{
SqlConnection cn=new SqlConnection(sqlstr);
cn.Open();
SqlCommand cmd=cn.CreateCommand();
cmd.CommandText="select 照片 from employees where id="+lbrecord.Text ;
SqlDataReader dr=cmd.ExecuteReader();
if(dr.Read())
{
MessageBox.Show(dr["照片"].ToString());
byte[] imagedata=(byte[])dr["照片"];
MemoryStream sm = new MemoryStream();
sm.Write(imagedata, 0, imagedata.Length);
Bitmap img = new Bitmap (sm);
pictureBox1.Image = img;
}
//MessageBox.Show (sm.ToString());
cn.Close();
}