怎么在SQL Server2012中保存照片和在C#Winform中显示照片
用image类型存储。http://www.cnblogs.com/samcn/articles/1275072.html
http://www.cnblogs.com/jxsoft/archive/2011/07/11/2103268.html
Orimage为Image字段,界面上放一个pictureBox1表示文件
private void button1_Click(object sender, EventArgs e)
{
string sql = "";
sql = "SELECT OrName,OrTel, Orimage FROM Organize WHERE OrID = 1"; //
SqlConnection conn = new SqlConnection(DBConnectioin.conStr);
SqlCommand cmd = new SqlCommand(sql, conn);
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
reader.Read();
this.textBox1.Text =(string) reader["OrName"];
textBox2.Text = (string)reader["OrTel"];
MemoryStream ms = new MemoryStream((byte[])reader["Orimage"]);
Image image = Image.FromStream(ms, true);
reader.Close();
conn.Close();
pictureBox1.Image = image;
}
可以直接存储物理路径吧。