VB怎么按条件读取ACCESS图片数据 VB怎么按条件读取ACCESS图片 + 数据,最好能够显示在MSHFlexGrid上,先谢谢大家了! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 按条件读取iRe.Open "select * from my_table id ='" & text1 & "'", iConc, adOpenKeyset, adLockReadOnly 那图片是OLE二进制的,不用转换回来吗? 你这个帖子不已经解决了吗?http://topic.csdn.net/u/20101007/10/56f32c26-5660-4811-b036-4e6a80d855d2.html 我不会连起来,我要么只能读数据,要么只能读图片,图片只能读到Image,也不能按条件读图片,来来去去就只能读一张!拜托了,帮下忙,谢谢! Dim cnnImage As New ADODB.ConnectionDim rsImage As New ADODB.RecordsetDim strSql As StringDim Chunk() As ByteDim lngLengh As LongDim intChunks As IntegerDim intFragment As IntegerConst ChunkSize = 1000Const lngDataFile = 1 Strpassword = Form4.passwordstrFileName = Form4.fun_GetFileName() rsImage.LockType = adLockOptimistic rsImage.CursorType = adOpenKeyset cnnImage.Provider = "Microsoft.Jet.OLEDB.4.0" strSql = strFileName cnnImage.Open strSql strSql = "Select * From data" rsImage.Open strSql, cnnImage If (rsImage.BOF = True) And (rsImage.EOF = True) Then Exit Sub Open "pictemp" For Binary Access Write As lngDataFile lngLengh = rsImage!photo.ActualSize intChunks = lngLengh \ ChunkSize intFragment = lngLengh Mod ChunkSize ReDim Chunk(intFragment) Chunk() = rsImage!photo.GetChunk(intFragment) Put lngDataFile, , Chunk() For I = 1 To intChunks ReDim Buffer(ChunkSize) Chunk() = rsImage!photo.GetChunk(ChunkSize) Put lngDataFile, , Chunk() Next I Close lngDataFile FileName = "pictemp" Image1.Picture = LoadPicture(FileName)End Sub这个只能读到Image,不能按条件! Dim cnnImage As New ADODB.Connection Dim rsImage As New ADODB.Recordset Dim strSql As String Dim Chunk() As Byte Dim lngLengh As Long Dim intChunks As Integer Dim intFragment As Integer Const ChunkSize = 1000 Const lngDataFile = 1 Strpassword = Form4.password strFileName = Form4.fun_GetFileName() rsImage.LockType = adLockOptimistic rsImage.CursorType = adOpenKeyset cnnImage.Provider = "Microsoft.Jet.OLEDB.4.0" strSql = strFileName cnnImage.Open strSql strSql = "Select * From data where id = '" & text1 & "'" rsImage.Open strSql, cnnImage If (rsImage.BOF = True) And (rsImage.EOF = True) Then Exit Sub Open "pictemp" For Binary Access Write As lngDataFile lngLengh = rsImage!photo.ActualSize intChunks = lngLengh \ ChunkSize intFragment = lngLengh Mod ChunkSize ReDim Chunk(intFragment) Chunk() = rsImage!photo.GetChunk(intFragment) Put lngDataFile, , Chunk() For I = 1 To intChunks ReDim Buffer(ChunkSize) Chunk() = rsImage!photo.GetChunk(ChunkSize) Put lngDataFile, , Chunk() Next I Close lngDataFile FileName = "pictemp" Image1.Picture = LoadPicture(FileName) 行了,非常感谢,那如果要加上数据一起查到MSHFlexGrid,是不是要建立两个查询啊?这个Pictemp临时文件在桌面,能不能改到目录下啊?再帮一下忙,你的帮忙真如雪中送炭! 我有一套完整的ACCESS存储图片的程序,需要的留个邮箱。 Dim cnnImage As New ADODB.Connection Dim rsImage As New ADODB.Recordset Dim strSql As String Dim Chunk() As Byte Dim lngLengh As Long Dim intChunks As Integer Dim intFragment As Integer Const ChunkSize = 1000 Const lngDataFile = 1 Strpassword = Form4.password strFileName = Form4.fun_GetFileName() rsImage.LockType = adLockOptimistic rsImage.CursorType = adOpenKeyset cnnImage.Provider = "Microsoft.Jet.OLEDB.4.0" strSql = strFileName cnnImage.Open strSql strSql = "Select * From data where id = '" & text1 & "'" rsImage.Open strSql, cnnImage If (rsImage.BOF = True) And (rsImage.EOF = True) Then Exit Sub FileName = App.Path & "\pictemp" Open FileName For Binary Access Write As lngDataFile lngLengh = rsImage!photo.ActualSize intChunks = lngLengh \ ChunkSize intFragment = lngLengh Mod ChunkSize ReDim Chunk(intFragment) Chunk() = rsImage!photo.GetChunk(intFragment) Put lngDataFile, , Chunk() For I = 1 To intChunks ReDim Buffer(ChunkSize) Chunk() = rsImage!photo.GetChunk(ChunkSize) Put lngDataFile, , Chunk() Next I Close lngDataFile Image1.Picture = LoadPicture(FileName) 编译错误 缺少:语句结束 vba中如何自己编写带可选参数的方法或者过程? 请问自定义SUB(参数) 什么时候不必填参数 那位高人给个钩子程序源码,要求能执行 access 里类似于 mssql里的 charindex() 然后截取部分字符串? listbox控件问题 向高手求助---VB程序控制外部显示 谁能告诉我 怎样用vb 连接 access 数据库(代码)?100分 自认能用VB玩转注册表的高手高手高高手请进>>>>>> 一个困扰我很久的关于数据库的问题,清高手指点 请教两种树的名字 任意五个数的修约问题
iRe.Open "select * from my_table id ='" & text1 & "'", iConc, adOpenKeyset, adLockReadOnly
那图片是OLE二进制的,不用转换回来吗?
你这个帖子不已经解决了吗?
http://topic.csdn.net/u/20101007/10/56f32c26-5660-4811-b036-4e6a80d855d2.html
要么只能读图片,图片只能读到Image,也不能按条件读图片,来来去去就只能读一张!
拜托了,帮下忙,谢谢!
Dim rsImage As New ADODB.Recordset
Dim strSql As StringDim Chunk() As Byte
Dim lngLengh As Long
Dim intChunks As Integer
Dim intFragment As Integer
Const ChunkSize = 1000
Const lngDataFile = 1
Strpassword = Form4.password
strFileName = Form4.fun_GetFileName()
rsImage.LockType = adLockOptimistic
rsImage.CursorType = adOpenKeyset
cnnImage.Provider = "Microsoft.Jet.OLEDB.4.0"
strSql = strFileName
cnnImage.Open strSql
strSql = "Select * From data"
rsImage.Open strSql, cnnImage
If (rsImage.BOF = True) And (rsImage.EOF = True) Then Exit Sub
Open "pictemp" For Binary Access Write As lngDataFile
lngLengh = rsImage!photo.ActualSize
intChunks = lngLengh \ ChunkSize
intFragment = lngLengh Mod ChunkSize
ReDim Chunk(intFragment)
Chunk() = rsImage!photo.GetChunk(intFragment)
Put lngDataFile, , Chunk()
For I = 1 To intChunks
ReDim Buffer(ChunkSize)
Chunk() = rsImage!photo.GetChunk(ChunkSize)
Put lngDataFile, , Chunk()
Next I
Close lngDataFile
FileName = "pictemp"
Image1.Picture = LoadPicture(FileName)
End Sub这个只能读到Image,不能按条件!
Dim rsImage As New ADODB.Recordset
Dim strSql As String
Dim Chunk() As Byte
Dim lngLengh As Long
Dim intChunks As Integer
Dim intFragment As Integer
Const ChunkSize = 1000
Const lngDataFile = 1
Strpassword = Form4.password
strFileName = Form4.fun_GetFileName()
rsImage.LockType = adLockOptimistic
rsImage.CursorType = adOpenKeyset
cnnImage.Provider = "Microsoft.Jet.OLEDB.4.0"
strSql = strFileName
cnnImage.Open strSql
strSql = "Select * From data where id = '" & text1 & "'"
rsImage.Open strSql, cnnImage
If (rsImage.BOF = True) And (rsImage.EOF = True) Then Exit Sub
Open "pictemp" For Binary Access Write As lngDataFile
lngLengh = rsImage!photo.ActualSize
intChunks = lngLengh \ ChunkSize
intFragment = lngLengh Mod ChunkSize
ReDim Chunk(intFragment)
Chunk() = rsImage!photo.GetChunk(intFragment)
Put lngDataFile, , Chunk()
For I = 1 To intChunks
ReDim Buffer(ChunkSize)
Chunk() = rsImage!photo.GetChunk(ChunkSize)
Put lngDataFile, , Chunk()
Next I
Close lngDataFile
FileName = "pictemp"
Image1.Picture = LoadPicture(FileName)
那如果要加上数据一起查到MSHFlexGrid,是不是要建立两个查询啊?
这个Pictemp临时文件在桌面,能不能改到目录下啊?
再帮一下忙,你的帮忙真如雪中送炭!
Dim rsImage As New ADODB.Recordset
Dim strSql As String
Dim Chunk() As Byte
Dim lngLengh As Long
Dim intChunks As Integer
Dim intFragment As Integer
Const ChunkSize = 1000
Const lngDataFile = 1
Strpassword = Form4.password
strFileName = Form4.fun_GetFileName()
rsImage.LockType = adLockOptimistic
rsImage.CursorType = adOpenKeyset
cnnImage.Provider = "Microsoft.Jet.OLEDB.4.0"
strSql = strFileName
cnnImage.Open strSql
strSql = "Select * From data where id = '" & text1 & "'"
rsImage.Open strSql, cnnImage
If (rsImage.BOF = True) And (rsImage.EOF = True) Then Exit Sub
FileName = App.Path & "\pictemp"
Open FileName For Binary Access Write As lngDataFile
lngLengh = rsImage!photo.ActualSize
intChunks = lngLengh \ ChunkSize
intFragment = lngLengh Mod ChunkSize
ReDim Chunk(intFragment)
Chunk() = rsImage!photo.GetChunk(intFragment)
Put lngDataFile, , Chunk()
For I = 1 To intChunks
ReDim Buffer(ChunkSize)
Chunk() = rsImage!photo.GetChunk(ChunkSize)
Put lngDataFile, , Chunk()
Next I
Close lngDataFile
Image1.Picture = LoadPicture(FileName)