<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[观夏Note]]></title> 
<link>//gm.angeldm.com/index.php</link> 
<description><![CDATA[新技术番]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[观夏Note]]></copyright>
<item>
<link>//gm.angeldm.com/post//</link>
<title><![CDATA[把图片读到pictureBox，再写入数据库SQL sever]]></title> 
<author>果面 &lt;admin@yourname.com&gt;</author>
<category><![CDATA[程序开发]]></category>
<pubDate>Sat, 14 Jun 2008 14:57:02 +0000</pubDate> 
<guid>//gm.angeldm.com/post//</guid> 
<description>
<![CDATA[ 
	把图片读到pictureBox，再写入数据库<br/><br/>SqlConnection conn=new SqlConnection(@"data source=chenyuming2004&#92;VSdotNET;uid=sa;pwd=cym;database=lhf");<br/>conn.Open();<br/>SqlCommand cmd=new SqlCommand("insert into fuser values ('1a','1b',@i)",conn);<br/>byte[] ib=new Byte[60000];<br/>FileStream fs=new FileStream(@"D:&#92;windows temp&#92;temp&#92;1.jpg",FileMode.Open ,FileAccess.Read );<br/>fs.Read(ib,0,60000);<br/>cmd.Parameters.Add("@i",SqlDbType.Image,(int)fs.Length);<br/>cmd.Parameters["@i"].Value=ib;<br/>cmd.ExecuteNonQuery();<br/>conn.Close();<br/><br/>-------------------------------------------------------<br/>从数据库读图片到picturebox<br/><br/>SqlConnection conn=new SqlConnection(@"data source=chenyuming2004&#92;VSdotNET;uid=sa;pwd=cym;database=lhf");<br/>conn.Open();<br/>SqlCommand cmd=new SqlCommand("select 照片 from fuser where password='1b'",conn);<br/>SqlDataReader reader=cmd.ExecuteReader();<br/>reader.Read();<br/>MemoryStream buf=new MemoryStream((byte[])reader[0]);<br/>Image image=Image.FromStream(buf,true);<br/>pictureBox1.Image=image;
]]>
</description>
</item><item>
<link>//gm.angeldm.com/read.php?&amp;guid=0#topreply</link>
<title><![CDATA[[评论] 把图片读到pictureBox，再写入数据库SQL sever]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>//gm.angeldm.com/read.php?&amp;guid=0#topreply</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>