
Type Mismatch returning variant array from COM object
Here's the scenario:
I am using RDS to return a recordset from a server component to the
client. After updating the recordset, I place it into a
multi-dimensional array, along with some other parameters as follows:
Set aryRS(0,0) = objRS
aryRS(0,1) = "UserKey"
aryRS(0,2) = "CheckConstraintSproc"
aryRS(0,3) = True
I pass this array back to the server component to process any
modifications. If all works fine, it comes back to the client just
fine. But, if there is an error that occurs in the component during an
UpdateBatch, and it jumps into my error handling, when it returns to
the client, I get a type mismatch error, and the entire array is empty
as follows:
aryRS(0,0) = Nothing
aryRS(0,1) = Empty
aryRS(0,2) = Empty
aryRS(0,3) = Empty
Of course I am passing this array ByRef, and all my server side
variables are dimensioned as Variant. All works fine when I am using a
VB client to test it, but not so in VBScript.
Even more intriguing is the fact that I also pass an empty array up to
the component along with my aryRS to collect errors as follows:
blnResult = UpdateRS(aryRS, aryErrors)
When I get the type mismatch, the aryErrors is fine, and contains any
error messege that the error handler placed into it.
For more detail into this dilemna, when this information is passed to
the component, I set a temporary recordset to the recordset array
element and do the processing with it, as follows:
Set rsTemp = aryRS(0, 0)
With rsTemp
.Filter = adFilterPendingRecords
. . . .
If .EditMode = adEditDelete Then
' do stuff
.UpdateBatch ' constraint error occurs here,
' jump to error handler
End If
End With
Err_Handler:
' collect errors and put them into aryErrors
' rollback transaction
When we get back to the client, we have a type mismatch
error and the aryRS is as I mentioned earlier, empty.
Any help for this one, will be many times thanked.
Joanthan
Any additional code that is needed to solve
this can be supplied also. . .
Thanks