日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關咨詢
選擇下列產品馬上在線溝通
服務時間:8:30-17:00
你可能遇到了下面的問題
關閉右側工具欄

新聞中心

這里有您想知道的互聯(lián)網營銷解決方案
iBATIS.NET執(zhí)行存儲過程實例詳解

iBATIS.NET執(zhí)行存儲過程是怎么進行的呢?那么我們就開始我們的講解:

首先我們看看XML的配置,映射XML文件書寫如下

 
 
 
  1. ﹤?xml version="1.0" encoding="utf-8" ?﹥  
  2.  
  3. ﹤sqlMap namespace="Member" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="SqlMap.xsd"﹥  
  4.     ﹤resultMaps﹥  
  5.         ﹤resultMap id="SelectResult" class="PlatAdmin.Model.Member"﹥  
  6.             ﹤result property="Id" column="id" /﹥  
  7.             ﹤result property="Identityno" column="identityno" /﹥  
  8.             ﹤result property="Telephone" column="telephone" /﹥  
  9.             ﹤result property="Email" column="email" /﹥  
  10.             ﹤result property="Linktel" column="linktel" /﹥  
  11.             ﹤result property="Address" column="address" /﹥  
  12.             ﹤result property="Content" column="content" /﹥  
  13.             ﹤result property="Username" column="username" /﹥  
  14.             ﹤result property="Password" column="password" /﹥  
  15.             ﹤result property="Truename" column="truename" /﹥  
  16.             ﹤result property="Enable" column="enable" /﹥  
  17.             ﹤result property="Regdate" column="regdate" /﹥  
  18.         ﹤/resultMap﹥  
  19.     ﹤/resultMaps﹥  
  20.           
  21.     ﹤parameterMaps﹥  
  22.         ﹤parameterMap id="swapParas" class="PlatAdmin.Model.Member"﹥  
  23.             ﹤parameter property="querystr" column="" /﹥  
  24.             ﹤parameter property="keyfield" column="" /﹥  
  25.             ﹤parameter property="pagesize" column="" /﹥  
  26.             ﹤parameter property="pagenumber" column="" /﹥  
  27.         ﹤/parameterMap﹥  
  28.     ﹤/parameterMaps﹥  
  29.       
  30.     ﹤statements﹥  
  31.         ﹤procedure id="GetMemberList" parameterMap="swapParas" resultMap="SelectResult"﹥  
  32.             usp_GetRecordset  
  33.         ﹤/procedure﹥  
  34.  
  35.           
  36.     ﹤/statements﹥  
  37. ﹤/sqlMap﹥ 

iBATIS.NET執(zhí)行存儲過程實例程序代碼如下:

 
 
 
  1. public IList GetMemberList(string querystr,int pageNo)  
  2.         {  
  3.             Hashtable ht = new Hashtable();  
  4.             ht.Add("querystr",querystr);  
  5.             ht.Add("keyfield","id");  
  6.             ht.Add("pagesize",2);  
  7.             ht.Add("pagenumber",pageNo);  
  8.  
  9.             SqlMapper sqlMap = IBatisNet.DataMapper.Mapper.Instance();  
  10.  
  11.             try 
  12.             {  
  13.                 return sqlMap.QueryForList("GetMemberList",ht);  
  14.             }  
  15.             catch(Exception e)  
  16.             {  
  17.                 throw new IBatisNetException(e.Message,e);  
  18.             }  
  19.         } 

iBATIS.NET執(zhí)行存儲過程實例的情況就介紹到這里,希望對你有所幫助。

【編輯推薦】

  1. iBATIS教程之like語句的寫法淺析
  2. iBATIS.NET多數據庫支持淺析
  3. iBATIS教程之如何獲得output參數值
  4. iBATIS.NET處理多參數的SQL語句的配置
  5. iBATIS.NET與VS 2005進行單元測試淺析

網頁標題:iBATIS.NET執(zhí)行存儲過程實例詳解
網站地址:http://www.dlmjj.cn/article/djposdh.html