ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henry Lu <z...@umich.edu>
Subject c# ibatis-email swap example
Date Mon, 20 Feb 2006 18:34:08 GMT
Is there anyone can help me out for email swap example?

 I have my code:

create or replace procedure
ps_swap_email_address (inout_email_1 in out varchar2, inout_email_2 in 
out varchar2)
is
 tmp_e varchar2(120);
begin
 tmp_e := inout_email_1;
 inout_email_1 := inout_email_2;
 inout_email_2 := tmp_e;
end;
/

<parameterMap id="swap_result" class="System.Collections.Hashtable">
 <parameter property="email_1" column="inout_email_1"/>
 <parameter property="email_2" column="inout_email_2"/>
</parameterMap>

<statement id="call_ps_swap_email_address" parameterMap="swap_result">
call ps_swap_email_address(?,?)
</statement>

           string first = "1_Joe.Dalton@somewhere.com";
           string second = "2_Averel.Dalton@somewhere.com";

           Hashtable map = new Hashtable();
           map.Add("email_1", first);
           map.Add("email_2", second);

           sqlMapper.QueryForObject("call_ps_swap_email_address", map);

           Console.WriteLine("1="+map["email_1"].ToString());
           Console.WriteLine("2="+map["email_2"].ToString());

But the results didn't swap the email values.

If I change the sqlmap.xml file to:

<parameterMap id="swap_result" class="System.Collections.Hashtable">
 <parameter property="email_1" column="inout_email_1" 
direction="InputOutput" />
 <parameter property="email_2" column="inout_email_2" 
direction="InputOutput" />
</parameterMap>

I go the following errors:

Object reference not set to an instance of an object.
  at 
IBatisNet.DataMapper.MappedStatements.MappedStatement.RetrieveOutputParame
ters(RequestScope request, IDalSession session, IDbCommand command, 
Object resul
t)
  at 
IBatisNet.DataMapper.MappedStatements.MappedStatement.RunQueryForObject(Re
questScope request, IDalSession session, Object parameterObject, Object 
resultOb
ject)
  at 
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObjec
t(IDalSession session, Object parameterObject, Object resultObject)
  at 
IBatisNet.DataMapper.MappedStatements.MappedStatement.ExecuteQueryForObjec
t(IDalSession session, Object parameterObject)
  at IBatisNet.DataMapper.SqlMapper.QueryForObject(String statementName, 
Object
parameterObject)


-Henry


Mime
View raw message