扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
strPath = App.Path If Right(strPath, 1) <> "\" Then strPath = strPath & "\" MyData.DatabaseName = strPath & "ExampleDB.mdb" '数据库存地址 MyData.RecordSource = "Info" '表名 |
Dim RS As New ADODB.Recordset Dim Chunk() As Byte Const ChunkSize As Integer = 2384 Dim DataFile As Integer, Chunks, Fragment As Integer Dim MediaTemp As String Dim lngOffset, lngTotalSize As Long Dim i As Integer |
RS.Source = "select * from Info Where Name='" & sparaName &"';" RS.ActiveConnection = "UID=;PWD=;DSN=TestDB;" RS.Open If RS.EOF Then RS.cCose : Exit Sub |
MediaTemp = strPath & "picturetemp.tmp" DataFile = 1 Open MediaTemp For Binary Access Write As DataFile lngTotalSize = RS!MyPhoto.ActualSize Chunks = lngTotalSize \ ChunkSize Fragment = lngTotalSize Mod ChunkSize ReDim Chunk(Fragment) Chunk() = RS!MyPhoto.GetChunk(Fragment) Put DataFile, , Chunk() For i = 1 To Chunks ReDim Chunk(ChunkSize) Chunk() = RS!MyPhoto.GetChunk(ChunkSize) Put DataFile, , Chunk() Next i Close DataFile |
RS.Close If MediaTemp = "" Then Exit Sub Picture1.Picture = LoadPicture(MediaTemp) If Picture1.Picture = 0 Then Exit Subj |
RS.Source = "select * from Info ;" RS.CursorType = adOpenKeyset RS.LockType = adLockOptimistic RS.ActiveConnection = "UID=;PWD=;DSN=TestDB;" RS.Open |
RS.AddNew DataFile = 1 Open strPathPicture For Binary Access Read As DataFile FileLen = LOF(DataFile) ' 文件中数据长度 If FileLen = 0 Then : Close DataFile : RS.Close : Exit Sub Chunks = FileLen \ ChunkSize Fragment = FileLen Mod ChunkSize ReDim Chunk(Fragment) Get DataFile, , Chunk() RS!MyPhoto.AppendChunk Chunk() ReDim Chunk(ChunkSize) For i = 1 To Chunks Get DataFile, , Chunk() RS!MyPhoto.AppendChunk Chunk() Next i Close DataFile |
RS.Update RS.Close Set RS = Nothing |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者