SqlConnection sqlcon = new SqlConnection(" Data Source=PC-20090625HIOS \\SQLEXPRESS;Initial Catalog=student;Integrated Security=True");
sqlcon.Open();
string str = "select uphoto from user2 where uname='"+textBox1.Text.Trim()+"'";
SqlCommand cmd = new SqlCommand(str, sqlcon);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
pictureBox2.Image =(Image)dr["uphoto"];
}
else
{
MessageBox.Show("121");
}
这段代码错在哪里呢?我是想从数据库里把图片读取出来
我的数据库里面已经有把图片添加进去了