SqlConnection conn = new SqlConnection("server=.;uid=sa;pwd=123;database=am89resource");
conn.Open();
SqlCommand cmd = new SqlCommand("", conn);
cmd.CommandText = "select * from picture where id='0331010009'";
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
byte[] bytes = (byte[])dr["img"];
FileStream fs = new FileStream(Server.MapPath("//img//1.gif"), FileMode.Create, FileAccess.Write);
fs.Write(bytes, 0, bytes.Length);
fs.Flush();
fs.Close();
}
conn.Close();