PDA

Click to See Complete Forum and Search --> : Problem when Loading Binary field in to Oracle Long Raw Field


gavin1
May 14th, 2000, 01:04 PM
Hi,
Guys thank you for replying I managed to get the `addnew ` method working when I used ODBC isted of OLEDB. But now the is still an error when. It does not load in to Oracle still.

I have given the code bellow, I would verry much appriciate you hellp.

I'm now using a system DSN for the microsoft Oracle ODBC provider
as ("DSN=vitest;Password=ets_agent;User ID=ets_agent")

'---------------------------------------------------------
Public Function UploadBanner(ByVal varBanner As Variant, _
ByVal strAgnet_code As String, ByVal strconstring As String, _
ByVal strFileType As String, ByVal strPath As String) As String

On Error GoTo Err_UploadBanner

Dim adoConn As New ADODB.Connection
Dim adoRecSet As New ADODB.Recordset

Dim mSql As String
Dim strFileName As String
Dim strErr_code As String
Dim totChunkSize As Variant
Dim readChunkSize As Variant
Dim saveReadChunkSize As Variant
Dim varChunk() As Byte
Dim i As Long

adoConn.ConnectionString = strconstring
adoConn.ConnectionTimeout = 60
adoConn.Open

'.........................................
mSql = "select * from ETS_T_Agents_Prm where Agent_Code = '" & strAgnet_code & "'"
'.............................................

adoRecSet.Open mSql, adoConn, adOpenKeyset, adLockOptimistic

Const conChunkSize = 32768 'chunks of 32KB


adoRecSet("BannerStatus").Value = "N"
adoRecSet("BannerFileName").Value = strAgnet_code & "_Banner." & strFileType

totChunkSize = LenB(varBanner)

If totChunkSize > conChunkSize Then
readChunkSize = conChunkSize
Else
readChunkSize = totChunkSize
End If

i = 1
Do While (i <= totChunkSize)
varChunk = MidB(varBanner, i, readChunkSize)
adoRecSet("AddBanner").AppendChunk varChunk

If (totChunkSize - (i + readChunkSize)) < readChunkSize Then
saveReadChunkSize = readChunkSize
readChunkSize = totChunkSize - (i + readChunkSize)
If readChunkSize = 0 Then
i = totChunkSize + 1
Else
i = i + saveReadChunkSize
End If
Else
i = i + readChunkSize
End If
Loop


adoRecSet.Update
adoRecSet.Close

end function