Article ID: 201236
Article Last Modified on 9/22/2005
Date Version Size File Name Platform ------------------------------------------------------ 12/07/99 2.12.4807.0 184KB Msdaora.dll All
Option Explicit
' Connection String
Const cnstr = "Provider=MSDAORA;Data Source=Ora8.world;User" & _
" ID=demo;Password=demo;"
Dim sqlstr As String
Private Sub Command1_Click()
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
' Don't throw an error in case the table does not exist
On Error Resume Next
sqlstr = "Create Table BlobTable (MYID Numeric Primary Key," & _
" TXTFLD Long)"
cn.Open cnstr
' Drop the table if it already exists
cn.Execute "Drop table Blobtable"
cn.Execute sqlstr
cn.Close
Set cn = Nothing
End Sub
Private Sub Command2_Click()
Dim rs As New ADODB.Recordset
Dim cn As New ADODB.Connection
Dim i As Integer
sqlstr = "Select MYID,TXTFLD from Blobtable where MYID=1"
cn.CursorLocation = adUseClient
cn.Open cnstr
With rs
.ActiveConnection = cn
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open sqlstr
End With
If rs.EOF Then
rs.AddNew
rs("MYID") = 1
rs.Update
rs.Requery
End If
For i = 1 To 1000
'Store a 1 MB string; smaller strings may seem to work.
rs.Fields("TXTFLD").AppendChunk String(1024, "x")
Next i
rs.Update
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
Private Sub Command3_Click()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
sqlstr = "Select MYID,TXTFLD from Blobtable where MYID=1"
cn.CursorLocation = adUseClient
cn.Open cnstr
With rs
.ActiveConnection = cn
.CursorType = adOpenStatic
.LockType = adLockOptimistic
.Open sqlstr
End With
' Print the actual size of the string stored in the database
Debug.Print rs.Fields("TXTFLD").ActualSize
rs.Close
Set rs = Nothing
cn.Close
Set cn = Nothing
End Sub
Private Sub Form_Load()
Command1.Caption = "Create Table"
Command2.Caption = "Insert Data"
Command3.Caption = "Retrieve Actual Size"
End Sub
192743 HOWTO: Use ADO GetChunk/AppendChunk with Oracle for TEXT Data
185958 HOWTO: Use ADO GetChunk/AppendChunk with Oracle for BLOB Data
Keywords: kbbug kbfix kboracle kbqfe kbdatabase kbfaq kbhotfixserver KB201236