Data type mismatch in criteria expression.

Apr 4 2006 3:34 PM
Hello,
what I am trying to do is a dinamyc treeview that take the source form a AccessDatabase. But I recieve that err:
Quote:

Data type mismatch in criteria expression.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.OleDb.OleDbException: Data type mismatch in criteria expression.

Source Error:


Line 91: Dim titlesForAuthors As New DataSet()
Line 92:
Line 93: adapter.Fill(titlesForAuthors)
Line 94:
Line 95: If titlesForAuthors.Tables.Count > 0 Then


Source File: C:\Documents and Settings\gosho\My Documents\Visual Studio 2005\WebSites\WebSite3\Default2.aspx Line: 93


And here is the part of the Source:

Code:
Private Sub FillTitlesForAuthors(ByVal node As TreeNode)

        Dim CategorID As Integer = node.Value
        Dim connString As String = ConfigurationManager.ConnectionStrings("autodib").ConnectionString
 
        Dim connection As New OleDb.OleDbConnection(connString)
 
        Dim command As New OleDb.OleDbCommand("Select Produkti.ProdID,Produkti.ImeProd From Produkti" + " Inner Join Kategoria on Kategoria.CategorID = Produkti.CategorID " + " Where Kategoria.CategorID = '" + CategorID + "'", connection)
 
        Dim adapter As New OleDb.OleDbDataAdapter(command)
 
        Dim titlesForAuthors As New DataSet()
 
        adapter.Fill(titlesForAuthors)
 
        If titlesForAuthors.Tables.Count > 0 Then
 
            Dim row As DataRow
            For Each row In titlesForAuthors.Tables(0).Rows
                Dim NewNode As TreeNode
                NewNode = New TreeNode(row("ImeProd").ToString(), row("ProdID").ToString())
 
                NewNode.PopulateOnDemand = False
 
                NewNode.SelectAction = TreeNodeSelectAction.None
 
                node.ChildNodes.Add(NewNode)
 
            Next
 
        End If
 
    End 


I've tried:
Code:
Dim command As New OleDb.OleDbCommand("Select Produkti.ProdID,Produkti.ImeProd From Produkti" + " Inner Join Kategoria on Kategoria.CategorID = Produkti.CategorID " + " Where Kategoria.CategorID = " + CategorID, connection)

And it didn't work Gave mi kind of query problem. Hope somebody has a better idea :o Thanks!