2010-07-15 20 views
0

我有一个奇怪的问题,我试图将三个记录集传递给一个方法,使它们在相同的数据库连接下充满数据。在运行下面的代码时,通过查看自定义日志记录信息,我可以看到在将传递给方法的记录集分配给方法中的局部变量时出现类型不匹配错误。将记录集传递给要填充的组件方法

所以当mthod被称为下面得到记录:

2010年7月15日上午10时59分47秒 - 开始GetALLRecordSets 2010年7月15日上午10时59分47秒 - 开始GetALLRecordSets RS初始化

奇怪的是,这个相同的代码在我们的beta服务器上工作,其中asp代码是相同的,并且组件dll是相同的。

有什么想法可能会导致此问题?


传统的ASP代码:

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组件代码:

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 

回答

0

不同version of MDAC在服务器上?您可能需要创建一个特定版本的Recordset,例如

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