Thanks for your quick response and very helpful tips!
After debugging with Profiler, I found that the return record set have some wrong aliases that have been mapped in resultMap. That’s why iBatis return the error. After modify the aliases, the store procedure is running properly.
From: Jehanzeb Musani
Sent: Monday, September 18, 2006 4:11 PM
Subject: RE: Sample DataMapper for MS-SQL Server's stored procedure
If you are using Sql Server, then run the profiler and check the statement that IBatis generated to execute your stored procedure. First try to sort out what is causing the error; I mean the error when IBatis is trying to execute the stored procedure and setting the parameter passed by you or when IBatis is trying to populate your specified class from the resultset. For this I will suggest you to first try to execute the procedure that does not have any parameter.
It will be helpful if you can copy the relevant extracts from the configuration files (Statements, parameter map and result map) and from the code files (the class you are specifying in parameter and result maps, the calling code).
From: Min Hui
Sent: Monday, September 18, 2006 12:58 PM
Subject: Sample DataMapper for MS-SQL Server's stored procedure
I am newbie with iBatis.NET. Currently I am still learning the framework. I have problem when testing call a store procedure with QueryForList() function.
I have created the stored procedure named SP_Get_Person that has one argument @PER_ID int. The sp is just select 1 record based on PER_ID passed. Here are mapper XML:
<procedure id="SP_GetPerson" parameterMap="spParam" resultMap="SelectAllResult">
<parameterMap id="spParam" class="Person">
<parameter property="Id" column="PER_ID" />
When running the application, I got error: “An unhandled exception of type System.IndexOutOfRangeException occurred in ibatisnet.datamapper.dll
I am very appreciate for any help