我vb做com+组件,组件中放所的业务作,提供给 asp 服务,速度很慢,激活后也是这样子,为什么?付上一段代码!
Public Function GetStorageLWarn(ByVal placeid As Integer) As Double
    Dim rs As ADODB.Recordset
    sql = "Select LWarn from Place where id='" & placeid & "'"
    Conn.getrecordset ConnStr, sql, rs
    If rs.EOF Then
        GetStorageLWarn = 0
    Else
        GetStorageLWarn = rs(0)
    End If
End Function
Public Function GetUseNumberByGoodsID(ByVal useID As Integer, ByVal goodsid As String) As Double
    Dim rs As ADODB.Recordset
    sql = "select Amount from UseGoods where UseApplyID='" & useID & "' and GoodsID='" & goodsid & "' and Type=1"
    Conn.getrecordset ConnStr, sql, rs
    If rs.EOF Then
        GetUseNumberByGoodsID = 0
    Else
        GetUseNumberByGoodsID = rs(0)
    End If
End FunctionPublic Function GetProjectLevel(ByVal ProjectPlanID As Integer) As Integer
    Dim rs As ADODB.Recordset
    sql = "select Project.ProjectLevel from Project,ProjectPlan where ProjectPlan.ID='" & ProjectPlanID & "' and Project.id=ProjectPlan.ProjectID"
    Conn.getrecordset ConnStr, sql, rs
    If rs.EOF Then
        GetProjectLevel = 0
    Else
        GetProjectLevel = rs(0)
    End If
End Function
Public Function PInGoods(id As Integer) As ADODB.Recordset
    Dim rs As New ADODB.Recordset
    Dim sql As String
    
    On Error GoTo ShowErr
    sql = "select * from v_ingoods where id=" & id
    Conn.getrecordset ConnStr, sql, rs
    Set PInGoods = rs
    Set rs = Nothing
    Exit Function
ShowErr:
    Set rs = Nothing
    Err.Raise vbObjectError + 100, "StoreRoom.RoomOP", "取得打印信息失败,请与管理员联系!"
End Function
Public Function POutGoods(id As Integer) As ADODB.Recordset
    Dim rs As New ADODB.Recordset
    Dim sql As String
    
    On Error GoTo ShowErr
    sql = "select * from v_outgoods where id=" & id
    Conn.getrecordset ConnStr, sql, rs
    Set POutGoods = rs
    Set rs = Nothing
    Exit Function
ShowErr:
    Set rs = Nothing
    Err.Raise vbObjectError + 100, "StoreRoom.RoomOP", "取得打印信息失败,请与管理员联系!"
End Function
Public Function PBackGoods(id As Integer) As ADODB.Recordset
    Dim rs As New ADODB.Recordset
    Dim sql As String
    
    On Error GoTo ShowErr
    sql = "select * from v_backgoods where id=" & id
    Conn.getrecordset ConnStr, sql, rs
    Set PBackGoods = rs
    Set rs = Nothing
    Exit Function
ShowErr:
    Set rs = Nothing
    Err.Raise vbObjectError + 100, "StoreRoom.RoomOP", "取得打印信息失败,请与管理员联系!"
End Function
Private Sub Class_Initialize()
    Set Conn = CreateObject("DataOP.Do")
    Set CIniFile = CreateObject("CIniFile.Do")
    CIniFile.IniFileName = "D:\eys-goods\EUERP\SysInit\DBLink.ini"
    user = CIniFile.ReadString("parameter", "user", 100)
    passwd = CIniFile.ReadString("parameter", "passwd", 100)
    DataSource = CIniFile.ReadString("parameter", "datasource", 100)
    Set CIniFile = Nothing
    
    ConnStr = "Provider=MSDAORA.1;Password=" & passwd & ";User ID=" & user & ";Data Source=" & DataSource & ";Persist Security Info=True"
End SubPrivate Sub Class_Terminate()
    Set Conn = Nothing
End Sub

解决方案 »

  1.   

    自己一步步调试,看是执行sql慢,还是其他原因
      

  2.   

    Com+配置可能会有关系。。
    还有连接池的使用可以提高性。。
    当前程序不要有问题:))
      

  3.   

    to:自由的活着
    自定义对像怎样才在脚本中使用呢?能发个组件例子和脚本例子让我看一下吗([email protected])?
      

  4.   

    我也是用VB写的DLL作为COM+,不觉得速度慢呀,可能要看一下自己的代码了,比如连接是否很频繁,数据处理等。
      

  5.   

    http://www.microsoft.com/china/msdn/library/techart/complus.asp
    研究一下