如何用pictureBox1显示存在sql server 2000数据库中的图片
SqlConnection conn = new SqlConnection("server=.;uid=sa;pwd=;database=jjdb2");
conn.Open();
string sqlstring = "select images from ttt where id='1'";
SqlCommand cmd = new SqlCommand(sqlstring,conn);
SqlDataReader sdr = cmd.ExecuteReader();
if (sdr.Read())
{
?????
}
pictureBox1.Image=????
写到这不会写了
哪位高手指点一下啊
------解决方案--------------------
请参考:http://blog.csdn.net/baihe_591/archive/2008/05/19/2457504.aspx
SqlConnection conn = new SqlConnection("server=.;uid=sa;pwd=;database=jjdb2");
conn.Open();
string strSql = "select images from ttt ";
SqlCommand cmd = new SqlCommand(strSql, conn);
DataSet ds=new DataSet();
SqlDataAdapter da= new SqlDataAdapter(cmd,conn);
da.Fill(ds);
MemoryStream ms = new MemoryStream((byte[])ds.Tables[0].Rows[0]["images"]);
Image image = Image.FromStream(ms);
pictureBox1.Image = image;
conn.Close();