首 页文章中心下载中心客户留言老站入口
您当前的位置:网页制作文章中心网络编程ASP.NET教程 → 文章内容 退出登录 用户管理
本类热门文章
相关下载
IBatisNet系列-执行存储过程
作者:佚名  来源:不详  发布时间:2008-7-29 19:45:22

减小字体 增大字体

映射xml文件书写如下


%26lt;?xml version=1.0 encoding=utf-8 ?%26gt;

%26lt;sqlMap namespace=Member xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation=SqlMap.xsd%26gt;
%26lt;resultMaps%26gt;
%26lt;resultMap id=SelectResult class=PlatAdmin.Model.Member%26gt;
%26lt;result property=Id column=id /%26gt;
%26lt;result property=Identityno column=identityno /%26gt;
%26lt;result property=Telephone column=telephone /%26gt;
%26lt;result property=Email column=email /%26gt;
%26lt;result property=Linktel column=linktel /%26gt;
%26lt;result property=Address column=address /%26gt;
%26lt;result property=Content column=content /%26gt;
%26lt;result property=Username column=username /%26gt;
%26lt;result property=Password column=password /%26gt;
%26lt;result property=Truename column=truename /%26gt;
%26lt;result property=Enable column=enable /%26gt;
%26lt;result property=Regdate column=regdate /%26gt;
%26lt;/resultMap%26gt;
%26lt;/resultMaps%26gt;

%26lt;parameterMaps%26gt;
%26lt;parameterMap id=swapParas class=PlatAdmin.Model.Member%26gt;
%26lt;parameter property=querystr column= /%26gt;
%26lt;parameter property=keyfield column= /%26gt;
%26lt;parameter property=pagesize column= /%26gt;
%26lt;parameter property=pagenumber column= /%26gt;
%26lt;/parameterMap%26gt;
%26lt;/parameterMaps%26gt;

%26lt;statements%26gt;
%26lt;procedure id=GetMemberList parameterMap=swapParas resultMap=SelectResult%26gt;
usp_GetRecordset
%26lt;/procedure%26gt;


%26lt;/statements%26gt;
%26lt;/sqlMap%26gt;
程序代码如下:


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

[] [返回上一页] [打 印]
文章评论 (评论内容只代表网友观点,与本站立场无关!)

用户名: 查看更多评论

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

         (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码

关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 管理登陆 yn11 QQ:1003368401