[VB6] Copier un champ BLOB vers un autre champ BLOB
Bonjour Old VB6 world,
Je suis en train de maintenir une vielle application en VB6.
Je dois dans cette application (client lourd avec Oracle 9i mais client 11g) copier un champ de type blob vers un champ de type blob. Pour cela j'ai codé la méthode FieldToField :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Public Sub Field2Field(ByRef fldSource As ADODB.Field, ByRef fldDestination As ADODB.Field, ItemJauge As BoWSmartUI.SmartItem)
Dim conChunkSize As Long
Dim st As ADODB.Stream
Dim lngOffset As Long
Dim lngTotalSize As Long
Dim strChunk() As Byte
On Error GoTo ErrHandler
Screen.MousePointer = vbHourglass
Set st = New ADODB.Stream
st.Type = adTypeBinary
st.Open
st.Write fldSource
fldDestination.Value = st.Read
st.Close
Screen.MousePointer = vbDefault
Exit Sub
ErrHandler:
MsgBox ("The copy of the attachment file failed")
Screen.MousePointer = vbDefault
End Sub |
Le problème est que après la ligne st.close, fldDestination est null, alors que fldSource n'est pas null. Et la copie ne se fait pas.
Est-ce bien le bon algorithme ?
Merci de vos réponses.