sql 2005和picturebox之间图片的存储和读取程序
目前正在开发个软件,需要保存用户的头像,谢谢了
程序代码:
fs = new (@"C:\Documents and Settings\Administrator\桌面\XXX.jpg", ); byte[] buf = new byte[fs.Length]; fs.Read(buf, 0, (int)fs.Length); string s = Convert.ToBase64String(buf); fs.Close();
还原
程序代码:
byte[] b = Convert.FromBase64String(s); ms = new (b); System.Drawing.Image img = System.Drawing.Image.FromStream(ms);