You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Andrew P Chan <an...@yahoo.com.hk> on 2008/09/19 05:14:20 UTC

ArgumentOutOfRangeException on tag with List

Hi guys,

I have a problem is using SQL Mapper with <iterate> tag, since I have a
requirement that I should form a QueryList which contains Query Object from
a Grid. (Because they need generic operator for example if the query string
contains %, operator will use “Like” instead of “=”) 

I have implemented this object and the list successfully, but I have to use
this list to query the database with iBatis framework,  I have followed some
instruction in the web and it throw “ArgumentOutOfRangeException”. Would
anyone help me to solve this problem? 

The example object is listed below:

Public Class QueryTO
        Dim _columnName As String
        Dim _columnValue As String
        Property ColumnName() As String
            Get
                Return _columnName
            End Get
            Set(ByVal value As String)
                Me._columnName = value
            End Set
        End Property

        Property ColumnValue() As String
            Get
                Return _columnValue
            End Get
            Set(ByVal value As String)
                Me._columnValue = value
            End Set
        End Property
End Class

The List Helper is listed below:
    Public Class QueryListHelper
        Dim _queryTOs As New List(Of QueryTO)
        Dim _aQueryTO As New QueryTO
        Public Property QueryList() As List(Of QueryTO)
            Get
                Return _queryTOs
            End Get
            Set(ByVal value As List(Of QueryTO))
                _queryTOs = value
            End Set
        End Property
        Public Sub addQueryList(ByVal aQueryTO As QueryTO)
            _queryTOs.Add(aQueryTO)
        End Sub
        Public Property SqlString() As String
            Get
                Dim result As String ""
                For i = 0 To _queryTOs.Count - 1
                Next
                Return result
            End Get
            Set(ByVal value As String)
            End Set
        End Property
    End Class

The SQLMapper select statement :

<select id ="getProductByList"
parameterClass="MMI.MMI.Model.QueryListHelper" resultMap="Products">
      select * from Products
      <dynamic prepend="WHERE ">
        <iterate property ="QueryList" open="" close="" conjunction=""
prepend="AND ">
          ?QueryList[].ColumnName? =  #QueryList[].ColumnValue#
        </iterate>
      </dynamic>
</select>



What else am I missing?  Or the way I do is wrong? Thank You for your help. 

Regards
Andrew Chan

-- 
View this message in context: http://www.nabble.com/ArgumentOutOfRangeException-on-%3Citerate%3E-tag-with-List-tp19565582p19565582.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.