IBatisNet系列-执行存储过程

映射xml文件书写如下

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

 程序代码如下:

None.gif public  IList GetMemberList( string  querystr, int  pageNo)
ExpandedBlockStart.gifContractedBlock.gif        
dot.gif {
InBlock.gif            Hashtable ht 
= new Hashtable();
InBlock.gif            ht.Add(
"querystr",querystr);
InBlock.gif            ht.Add(
"keyfield","id");
InBlock.gif            ht.Add(
"pagesize",2);
InBlock.gif            ht.Add(
"pagenumber",pageNo);
InBlock.gif
InBlock.gif            SqlMapper sqlMap 
= IBatisNet.DataMapper.Mapper.Instance();
InBlock.gif
InBlock.gif            
try
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
return sqlMap.QueryForList("GetMemberList",ht);
ExpandedSubBlockEnd.gif            }

InBlock.gif            
catch(Exception e)
ExpandedSubBlockStart.gifContractedSubBlock.gif            
dot.gif{
InBlock.gif                
throw new IBatisNetException(e.Message,e);
ExpandedSubBlockEnd.gif            }

ExpandedBlockEnd.gif        }

转载于:https://www.cnblogs.com/maplye/archive/2006/03/25/358598.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值