WEB开发网      濠电娀娼ч崐濠氬疾椤愶附鍋熸い鏍ㄧ〒闂勫嫰鏌﹀Ο渚Ц闁诲氦顕ч湁婵犲﹤楠告禍鍓х磼鏉堛劌绗氶柟宄版嚇閹晠宕归銈嗘濠电偞鍨堕幐鎾磻閹捐秮褰掓偐閻戞﹩妫勯梺鎼炲妼鐎涒晝绮嬪澶樻晝闁挎繂鏌婇敃鍌涚厵閻庢稒锚閻忥絾绻濇繝鍐ㄧ伌闁诡垰鍟村畷鐔碱敂閸♀晙绱樺┑鐐差嚟婵儳螞閸曨剚鍙忛柍鍝勬噹缁€澶嬬箾閹存繄锛嶆鐐灲閹綊宕惰濡插鏌涢妸銉ヮ劉缂佸倸绉归弫鎾绘晸閿燂拷 ---闂備焦瀵уú鈺呭箯閿燂拷
开发学院WEB开发ASP.NET IBatisNet系列-执行存储过程 阅读

IBatisNet系列-执行存储过程

 2006-03-26 17:05:42 来源:WEB开发网 闂備線娼уΛ鎾箯閿燂拷闂備礁鎲¢崹鐢垫崲閹扮増鍎嶆い鎺戝€甸崑鎾斥槈濞嗗秳娌紓鍌氱▌閹凤拷濠电姭鎷冮崨顓濈捕闂侀潧娲ゅú銊╁焵椤掍胶鈯曢柕鍥╁仧缁辩偤鏁撻敓锟�闂備線娼уΛ鎾箯閿燂拷  闂備胶枪缁绘鈻嶉弴銏犳瀬闁绘劕鐏氱€氼剟姊洪崹顕呭剰闁逞屽墮缁夊綊寮婚妸褉鍋撻棃娑欏暈闁伙綀浜埀顒傛暬閸嬪﹪宕伴弽褏鏆﹂柨鐕傛嫹
核心提示:映射xml文件书写如下<?xml version="1.0" encoding="utf-8" ?><sqlMap namespace="Member" xmlns:xsi="http://www.w3.org/2001/XMLSc

映射xml文件书写如下


<?xml version="1.0" encoding="utf-8" ?>

<sqlMap namespace="Member" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SqlMap.xsd">
   <resultMaps>
     <resultMap id="SelectResult" class="PlatAdmin.Model.Member">
       <result PRoperty="Id" column="id" />
       <result property="Identityno" column="identityno" />
       <result property="Telephone" column="telephone" />
       <result property="Email" column="email" />
       <result property="Linktel" column="linktel" />
       <result property="Address" column="address" />
       <result property="Content" column="content" />
       <result property="Username" column="username" />
       <result property="PassWord" column="password" />
       <result property="Truename" column="truename" />
       <result property="Enable" column="enable" />
       <result property="Regdate" column="regdate" />
     </resultMap>
   </resultMaps>
    
   <parameterMaps>
     <parameterMap id="swapParas" class="PlatAdmin.Model.Member">
       <parameter property="querystr" column="" />
       <parameter property="keyfield" column="" />
       <parameter property="pagesize" column="" />
       <parameter property="pagenumber" column="" />
     </parameterMap>
   </parameterMaps>
  
   <statements>
     <procedure id="GetMemberList" parameterMap="swapParas" resultMap="SelectResult">
       usp_GetRecordset
     </procedure>

  
   </statements>
</sqlMap>
 程序代码如下:


public IList GetMemberList(string querystr,int pageNo)
     {
       Hashtable ht = new Hashtable();
       ht.Add("querystr",querystr);
       ht.Add("keyfield","id");
       ht.Add("pagesize",2);
       ht.Add("pagenumber",pageNo);

     SqlMapper sqlMap = IBatisNet.DataMapper.Mapper.Instance();

     try
       {
         return sqlMap.QueryForList("GetMemberList",ht);
       }
       catch(Exception e)
       {
         throw new IBatisNetException(e.Message,e);
       }
     }

出处:福娃莹莹 BLOG

Tags:IBatisNet 系列 执行

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接