Article ID: 192138
Article Last Modified on 3/2/2005
Column Name : String (BSTR) Column Type : Integer (VT_I2) Column Size : Integer (VT_I2) Column IsNullable : Bool (VT_BOOL)
Private Sub Command1_Click()
Dim blankrec As New DataFactory
Dim rst As ADOR.Recordset
Dim Record(0) As Variant
Dim Col1(3) As Variant
Dim str As String, i As Long
' Use the RDSServer.DataFactory to create an empty
' recordset. It takes an array of variants where
' every element is another array of
' variants, one for every column required in the
' recordset.
' The elements of the inner array are the column's
' name, type, size and nullability.
Col1(0) = "Text1"
Col1(1) = CInt(adLongVarChar)
' For our first pass this line remains uncommented to produce
' the error.
Col1(2) = 32768 'In order to pass a 32KB string.
' The following, when uncommented, creates the recordset without
' the error.
'Col1(2) = 256
Col1(3) = True
Record(0) = Col1
Set rst = blankrec.CreateRecordSet(Record) ' You get an error here
' when col2(2) > 32767.
For i = 1 To 1024 ' Build a 2MB string.
str = str & String(2000, "x")
Next i
rst.AddNew
rst(0) = str
rst.Update
Debug.Print rst(0).ActualSize 'To prove that the field holds
'the 2MB string.
End Sub
Col1(2) = 256 and comment Col1(2) = 32768Keywords: kbbug kbfix kbmdac210sp2fix kbdatabase kbmdacnosweep KB192138