会员
周边
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
福娃
博客园
首页
新随笔
联系
订阅
管理
随笔 - 70
文章 - 2
评论 - 208
阅读 -
17万
IBatisNet系列-执行存储过程
映射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);
}
}
posted @
2006-03-25 15:24
福娃
阅读(
4944
) 评论(
7
)
收藏
举报
刷新页面
返回顶部
登录后才能查看或发表评论,立即
登录
或者
逛逛
博客园首页
公告
昵称:
福娃
园龄:
19年5个月
粉丝:
5
关注:
0
<
2006年3月
>
日
一
二
三
四
五
六
26
27
28
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
5
6
7
8
点击右上角即可分享