第9章数据库编程-操作数据.pptVIP

  • 3
  • 0
  • 约6.29千字
  • 约 24页
  • 2017-05-30 发布于北京
  • 举报
第9章BLOB数据数据操作和水晶报表 9.1 BLOB数据(如图片)处理 9.1.1文件方式 以学生照片存储为例,每张照片是一个文件,student表中photo字类型varchar (256)保存照片文件路径 步骤: 1、将照片文件存到指定文件,并在表中保存文件路径 1)显示照片 FileInfo file;//声明一个文件对象 { //PictureBox控件和OpenFileDialog对话框,找到照片并显示。 OpenFileDialog dlg = new OpenFileDialog(); dlg.Filter = .png文件|*.png|.jpg文件|*.jpg|.jpeg文件|.jpeg|.gif文件|*.gif|.bmp文件|*.bmp; if (dlg.ShowDialog() == DialogResult.OK) { picphoto.Image=Image.FromFile(dlg.FileName); file=new FileInfo(dlg.FileName);//给文件对象赋值 } } 保存照片(文件保存到程序启动路径) //更新表 string sql = string.Format(update student set photo={0} where student_id={1}, fil

文档评论(0)

1亿VIP精品文档

相关文档