Thanks Tinister,
That was helpful.


Tinister wrote:
> 
> I stepped through it and determined it was due to mixing both the #Var#
> and $Var$ syntax.  In that example, iBatis replaces the #Id# with a
> question mark, and then later wants to replace the question mark with a
> DbParameter, but since $Sets$ also inserted a question mark things start
> breaking down.
> 
> You can get around this by strictly using the $Var$ syntax.  I have no
> idea if this is a priority for being fixed.
> 
> 
> collinp10 wrote:
>> 
>> Has this issue ever been resolved?  I'm running into this problem as
>> well.
>> 
>> Thanks for your response,
>> 
>> Collin
>> 
>> 
>> Tinister wrote:
>>> 
>>> Thanks for your reply.  Here's an example where I am getting an
>>> exception thrown.  I'm using version 1.6.1 of the DataMapper.
>>> 
>>> <update id="DynamicUpdate" parameterClass="Hashtable">
>>>   update TestDB.dbo.Main set $Sets$ where [ID] = #Id#
>>> </update>
>>> 
>>> public static void DoDynamicUpdate()
>>> {
>>>     Hashtable param = new Hashtable();
>>>     param.Add("Sets", "[Data]=N'Fo?o'");
>>>     param.Add("Id", 1);
>>> 
>>>     Mapper.Update( "DynamicUpdate", param );
>>> }
>>> 
>>> The exception is
>>> 
>>> System.ArgumentOutOfRangeException: Specified argument was out of the
>>> range of valid values.
>>> Parameter name: index
>>>    at
>>> IBatisNet.DataMapper.Configuration.ParameterMapping.ParameterPropertyCollection.get_Item(Int32
>>> index)
>>>    at
>>> IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory.EvaluateParameterMap()
>>>    at
>>> IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory.Prepare()
>>>    at
>>> IBatisNet.DataMapper.Configuration.Sql.SimpleDynamic.SimpleDynamicSql.BuildPreparedStatement(ISqlMapSessionsession,
>>> RequestScope request, String sqlStatement)
>>>    at
>>> IBatisNet.DataMapper.Configuration.Sql.SimpleDynamic.SimpleDynamicSql.GetRequestScope(IMappedStatementmappedStatement,
>>> Object parameterObject, ISqlMapSession session)
>>>    at
>>> IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteUpdate(ISqlMapSession
>>> session, Object parameterObject)
>>>    at IBatisNet.DataMapper.SqlMapper.Update(String statementName, Object
>>> parameterObject)
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Escaping-the-question-mark-tp16609896p22931924.html
Sent from the iBATIS - User - Cs mailing list archive at Nabble.com.

Reply via email to