插入后从.mdb文件检索图像的问题 [英] Issues in retrieving image from .mdb file after insertion

查看:56
本文介绍了插入后从.mdb文件检索图像的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dim arrimage() As Byte
      Dim oledb_Conn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\shanky.gupta\Desktop\manish.mdb")
      Dim cmd As New OleDb.OleDbCommand("select * from omsstaticcontent", oledb_Conn)
      oledb_Conn.Open()
      Using fs As FileStream = New FileStream("C:\Users\Public\Pictures\Sample Pictures\WatchFolder.jpg", FileMode.Open, FileAccess.Read, FileShare.Read)
          ReDim arrimage(fs.Length)
          fs.Read(arrimage, 0, fs.Length)
      End Using
      cmd.CommandText = "insert into omsstaticcontent(categoryid,communicationgroupid,reportid,imagepath,filetype,file) values(22,1,1,'C:\Users\Public\Pictures\Sample Pictures\WatchFolder.jpg','I','?')"
      cmd.Parameters.Add("?", OleDb.OleDbType.Binary, arrimage.Length).Value = arrimage
      cmd.ExecuteNonQuery()

      Dim da As New OleDb.OleDbDataAdapter("select * from omsstaticcontent where categoryid=22", oledb_Conn)

      Dim ds As New DataSet
      da.Fill(ds)

推荐答案

看看这里:从MS Access数据库保存和检索数据库中的图像 [ ^ ]


这篇关于插入后从.mdb文件检索图像的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆