tags:

views:

24

answers:

1

I am having an odd issue where I am trying to pass three recordsets to a method to have them filled with data all under the same database connection. By reviewing the custom logging info when running the code below I can see that I am getting a Type Mismatch error when assigning the recordsets passed to the method to the local variables within the method.

So the following gets logged when the mthod is called:

7/15/2010 10:59:47 AM - Begin GetALLRecordSets 7/15/2010 10:59:47 AM - Begin GetALLRecordSets RS initialization

The odd bit is that this same code works on our beta server where the asp code is identical and the component dll is identical.

Any thoughts on what may be causing this issue?


Classic ASP code:

set rs1= createobject("ADODB.Recordset")
set rs2 =createobject("ADODB.Recordset")
set rs3 = createobject("ADODB.Recordset")

set myObj = Server.CreateObject("Component.className")

call myObj.GetAllRecordSets(rs1, rs2, rs3)

VB6 Component Code:

Public Sub GetALLRecordSets(ByRef rs1 As Variant, _
                            ByRef rs2 As Variant, _
                            ByRef rs3 As Variant)
On Error GoTo ErrorSpot

    WriteToLog "Begin GetALLRecordSets", "", 0, ""

    Dim lngErrNum As Long
    Dim strErrDesc As String
    Dim filterStr As String
    Dim objConn As ADODB.Connection
    Dim myrs1 As ADODB.Recordset
    Dim myrs2 As ADODB.Recordset
    Dim myrs3 As ADODB.Recordset

    WriteToLog "Begin GetALLRecordSets RS initialization", "", 0, ""

    Set myrs1 = rs1
    Set myrs2 = rs2
    Set myrs3 = rs3

    WriteToLog "End GetALLRecordSets RS initialization", "", 0, ""

    Set rs1 = myrs1.Clone
    Set rs2 = myrs2.Clone
    Set rs3 = myrs3.Clone

ExitSpot:
    'Cleanup
    Exit Sub

ErrorSpot:
    'Save the error information
    lngErrNum = Err.Number
    strErrDesc = Err.Description
    'Log the error
    WriteToLog "GetALLRecordSets", strErrDesc, lngErrNum, strErrDesc    
End Sub
A: 

Different version of MDAC on server? You may need to create a specific version of Recordset e.g.

Set rs1 = CreateObject("ADODB.Recordset.2.8")

onedaywhen