string photo = ds.Tables[0].Rows[0]["photo"].ToString().Trim().Replace(" ", "");
string existPhoto = "Images\\" + photo;
//查找本地文件是否存在,
bool exist = System.IO.File.Exists(existPhoto);
//判断本地照片是否存在
if (exist == true)
{
pictureBox1.BackgroundImage = Image.FromFile("Images\\" + photo);
}
else
{
pictureBox1.BackgroundImage = Image.FromFile("PIC\\NotPhoto.jpg");
}