Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_components thread: Microsoft VBScript runtime (0x800A000D) Type Mismatch


Message #1 by "Shalon Huff" <shalonhuff@h...> on Tue, 17 Sep 2002 00:29:38
Help please!

I'm having a problem with this line of code
  
  Set Children = Visit.Catalog.GetChildCategories(Category("CategoryID"))
I've looked at my Catalog object and RunQuery method but can't seem to 
find an error
  
-->Catalog Object
  Option Explicit

Private m_utility As IUtility
Public Sub Configure(ByVal utility As IUtility)
  Set m_utility = utility
 
End Sub

Public Function AddCategory(ByVal Name As String, _
                Optional ByVal ParentID As Long) As Long
                
Dim NewCategory As New Recordset
NewCategory.Open "tblCategory_Shalon", m_utility.DB.DB, adOpenKeyset, _
                adLockOptimistic

NewCategory.AddNew
NewCategory("CategoryName") = Name

If ParentID <> 0 Then NewCategory("CategoryIDP") = ParentID

NewCategory.Update
AddCategory = NewCategory("CategoryID")

NewCategory.Close
Set NewCategory = Nothing

End Function

Private Function QueryCategories(Optional ByVal Where As String, _
                    Optional ByVal Order As String = "CategoryName", _
                    Optional ByVal AsKeyset As Boolean = False) _
                    As Recordset
                    
Set QueryCategories = m_utility.DB.RunQuery("tblCategory_Shalon", , _
                                        Where, Order, AsKeyset)
End Function
                    

Public Function GetCategories(Optional ByVal AsKeyset As Boolean = False) _
                As Recordset
    Set GetCategories = QueryCategories("CategoryIDP is null", , AsKeyset)
    
End Function

Public Function GetAllCategories(Optional ByVal AsKeyset As Boolean = 
False) _
                                    As Recordset
    Set GetAllCategories = QueryCategories(, , AsKeyset)
    
End Function

Public Function GetCategory(ByVal CategoryID As Long, _
                                Optional ByVal AsKeyset As Boolean = 
False) _
                                As Recordset
Set GetCategory = QueryCategories("CategoryID=" & CategoryID, , _
                                            AsKeyset)
                                            
End Function


Public Function GetChildCategories(ByVal CategoryID As Long, _
                            Optional ByVal AsKeyset As Boolean = False) _
                            As Recordset
                            
 Dim Where As String
 Where = "CategoryIDP=" & CategoryID

Set GetChildCategories = QueryCategories("CategoryIDP=" & CategoryID, , _
                                                AsKeyset)

                                                
End Function

'RunQuery - runs the query
Public Function RunQuery(ByVal TableName As String, _
                Optional ByVal ViewName As String, _
                Optional ByVal Where As String, _
                Optional ByVal Order As String, _
                Optional ByVal AsKeyset As Boolean = False, _
                Optional ByVal UseTable As Boolean = False) _
                As Recordset
                
Dim sql As String

sql = "select * from "
If ViewName = "" Or UseTable = True Then
    sql = sql & TableName
Else
    sql = sql & ViewName
End If

If Where <> "" Then sql = sql & " where " & Where

If Order <> "" Then sql = sql & " order by " & Order

If AsKeyset = False Then
    Set RunQuery = DB.Execute(sql)
Else
    Set RunQuery = New Recordset
    RunQuery.Open sql, DB, adOpenKeyset, adLockOptimistic
End If

End Function

Sorry for the long post.  Thanks in advance for your help!

Shalon
shalonhuff@h...

  Return to Index