先看下面的代码 我已经存进去了 但别人读不出来 我用VB代码存入的 人家用c++读取
SourceFile = FreeFile
Open sImageUrl For Binary As SourceFile
FileLength = LOF(SourceFile)
NumBlocks = FileLength \ Blocksize
LeftOver = FileLength Mod Blocksize 'remainder appended first
ReDim FileData(LeftOver)
Get SourceFile, , FileData()
vRsOfImage("Sr_DataEx").AppendChunk FileData() 'store the first image chunk
ReDim FileData(Blocksize)
For j = 1 To NumBlocks 'byte
Get SourceFile, , FileData()
vRsOfImage.Fields("Sr_DataEx").AppendChunk FileData() 'remaining chunks
DoEvents
Next j
Close SourceFile
vRsOfImage.Update
End If什么原因 ?或谁能给出一段带好的代码
SourceFile = FreeFile
Open sImageUrl For Binary As SourceFile
FileLength = LOF(SourceFile)
NumBlocks = FileLength \ Blocksize
LeftOver = FileLength Mod Blocksize 'remainder appended first
ReDim FileData(LeftOver)
Get SourceFile, , FileData()
vRsOfImage("Sr_DataEx").AppendChunk FileData() 'store the first image chunk
ReDim FileData(Blocksize)
For j = 1 To NumBlocks 'byte
Get SourceFile, , FileData()
vRsOfImage.Fields("Sr_DataEx").AppendChunk FileData() 'remaining chunks
DoEvents
Next j
Close SourceFile
vRsOfImage.Update
End If什么原因 ?或谁能给出一段带好的代码
Public Function ReadBinaryFile(ByVal FileName As String, fld As Field) As Boolean
Dim rstStream As New ADODB.Stream
'On Error GoTo err1
rstStream.Type = adTypeBinary
rstStream.Open
If IsNull(fld.Value) Then Exit Function
rstStream.Write fld.Value
rstStream.SaveToFile FileName, adSaveCreateOverWrite
ReadBinaryFile = True
Exit Function
err1:
MsgBox Err.Description, vbCritical, "错误号:" & Err.Number
End Function'写二进制流到数据库
Public Function WriteBinaryFile(ByVal FileName As String, fld As Field) As Boolean
Dim rstStream As New ADODB.Stream
On Error GoTo err1
rstStream.Type = adTypeBinary
rstStream.Open
rstStream.LoadFromFile FileName
fld.Value = Null
fld.Value = rstStream.Read
WriteBinaryFile = True
Exit Function
err1:
MsgBox Err.Description, vbCritical, "错误号:" & Err.Number
End Function