Hello. Does anyone try to execute procedure with optional parameters in the MS SQL database? I thought that for the procedure with optional parameters I need specify only obligatory parameters in the parameter map and parameter object and iBATIS will call procedure with that optional parameters. But it seems that all stored procedure parameters should be specified - doesn't matter - optional or obligatory it is. I don't like it because should enumerate 17 parameters instead of 3 in my code.
I've added all stored procedure parameters to the IDictionary variable. dictionary.Clear(); //obligatory parameters dictionary.Add("Id", transaction.ExternalID); dictionary.Add("Stamp", 0); dictionary.Add("ProcessMode", 1); dictionary.Add("ProcessFlag", 8); // optional parameters below dictionary.Add("PermitMode", 2); dictionary.Add("PermitFlag", 0); dictionary.Add("TreatMode", 2); dictionary.Add("TreatFlag", 0); dictionary.Add("DayDate", "12.12.1912"); dictionary.Add("InfoMode", 2); dictionary.Add("Info", string.Empty); dictionary.Add("NoteMode", 2); dictionary.Add("Note", string.Empty); dictionary.Add("SenderId", 0); dictionary.Add("ReceiverId", 0); dictionary.Add("SysError", 0); dictionary.Add("Dummy", 0); Some of that parameters should have NULL value. I've added the "nullValue" attribute in the parameter map for it. <parameter property="Id" column="Id"/> <parameter property="ProcessMode" column="ProcessMode"/> <parameter property="ProcessFlag" column="ProcessFlag"/> <parameter property="SysError" column="SysError" direction="Output"/> <parameter property="Stamp" column="Stamp" direction="Output"/> <parameter property="PermitMode"/> <parameter property="PermitFlag" nullValue="0"/> <parameter property="TreatMode"/> <parameter property="TreatFlag" nullValue="0"/> <parameter property="DayDate" nullValue="12.12.1912"/> <parameter property="InfoMode"/> <parameter property="Info" nullValue=""/> <parameter property="NoteMode"/> <parameter property="Note" nullValue=""/> <parameter property="SenderId" nullValue="0"/> <parameter property="ReceiverId" nullValue="0"/> <parameter property="Dummy" nullValue="0"/> But when this attribute is specified for the parameter, iBATIS throws exception in the IBatisNet.DataMapper.MappedStatements.MappedStatement.ApplyParameterMap method : "There is no Get property named 'PermitFlag' in class 'Hashtable'". How could I specify "nullValue" attribute for the IDictionary parameter? > -----Original Message----- > From: Gilles Bayon [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 23, 2004 6:37 PM > To: ibatis-user-cs@incubator.apache.org > Subject: RE: optional procedure parameters > > > It should contain only procedure name. > > -----Message d'origine----- > De : Alexey Boroday [mailto:[EMAIL PROTECTED] > Envoyà : jeudi 23 dÃcembre 2004 13:40 > à : ibatis-user-cs@incubator.apache.org > Objet : optional procedure parameters > > Hello. > > I want to execute MS SQL procedure with optional parameters. > Tell me please - how parameter map should looks to make it > possible. AFAIU > procedure statement should contain only procedure name or it > is possible to > list all paramaters with commas? > > Could I write something like > > <parameterMap> > <parameter property="prop1" column="param1"/> > <parameter property="prop2" column="param2"/> > <parameter property="prop3" column="param3"/> > <parameter property="prop4" column="param4"/> > </parameterMap> > <procedure id="TestProcedure" parameterMap="TestProcedureParams"> > TestProcedure #param1#, #param2#, #param3#, , , #param4# > </procedure> > > I don't want add unnecessary properties to my objects. > > -- > Ð ÑÐÐÐÐÐÐÐÐ, ÐÐÐÐÑÐÐ ÐÐÑÐÐÐÐ > ÐÑÐÐÐ ÑÐÐÑÐÐÐÑÐÐ ÐÐ > > > ______________________________________________________________ > _____________ > > This communication is confidential and may be legally privileged. > If you believe you are not an intended recipient, please > inform the sender, > delete the e-mail and do not copy, print or use it or > disclose it to others. > You can inform the sender by replying to this e-mail or by > telephone (+380 44 4906080). > > > -- > No virus found in this incoming message. > Checked by AVG Anti-Virus. > Version: 7.0.296 / Virus Database: 265.6.3 - Release Date: 21/12/2004 > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.296 / Virus Database: 265.6.3 - Release Date: 21/12/2004 > > > ___________________________________________________________________________ This communication is confidential and may be legally privileged. If you believe you are not an intended recipient, please inform the sender, delete the e-mail and do not copy, print or use it or disclose it to others. You can inform the sender by replying to this e-mail or by telephone (+380 44 4906080).