Im developing some sort of searcher using Ibatis.NET. So far, this is the sqlMap for the procedure:
<statement id="statementId" parameterClass="parameterObject" resultClass="resultClass">
DECLARE @table1 Table1,
@table2 Table2
INSERT INTO @table1 (Value1, Value2)
VALUES
<iterate property="valueList" open="(" close=")" conjunction="),(">
#valueList[].Item1#,#valueList[].Item2#
</iterate>
INSERT INTO @table2 (Value1, Value2)
VALUES
<iterate property="valueList2" open="(" close=")" conjunction="),(">
#valueList2[].Item1#,#valueList2[].Item2#
</iterate>
EXEC [SP_StoredProcedure]
@tvisible=@tvisible,
@tparametro=@tparametro,
</statement>
StoredProcedure will return a set of columns that is determined by parameter table1. Problem comes when i make a call returning 4 values, and then make another call returning 3 values, i get an index out of range exception. I think that sqlDataReader tries to read the 4 columns that were returned before, but this time the set only consists of 3 columns.
Any suggestions to solve this will be appreciated.