福娃
博客园
社区
首页
新随笔
联系
管理
订阅
随笔- 57 文章- 2 评论- 207
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
福娃
阅读(3406)
评论(11)
编辑
收藏
发表评论
549774
回复
引用
#1楼
2006-09-26 14:58
|
microsystem[未注册用户]
如果只需要返回一个值是否可以简单点?
回复
引用
查看
#2楼
[
楼主
]
2006-09-26 15:12
|
福娃
下面是不是你想要的?
<select id="selectProductCount" resultClass="System.Int32">
select count(1)
from PRODUCT
</select>
回复
引用
#3楼
2006-10-26 21:57
|
microsystem[未注册用户]
同意楼上的,要存储过程返回一个值是否可以
<procedure id="GetMemberList" parameterMap="swapParas" resultMap="int">
usp_GetRecordset
</procedure>
回复
引用
查看
#4楼
[
楼主
]
2006-10-27 08:20
|
福娃
在参数设置的时候,有direction="Input|Output|InputOutput
<parameterMap id="insert-product-param" class="Product">
<parameter property="description" direction=“Output” />
<parameter property="id"/>
</parameterMap>
这是我在他的文档上看到的,我还没有测试!
你可以试试看!
回复
引用
#5楼
2006-10-27 11:35
|
microsystem[未注册用户]
这个也看到了,测试中...
回复
引用
#6楼
2006-10-30 12:24
|
microsystem[未注册用户]
试验了好久!怎么也取不到!
你那里怎么样啊?
回复
引用
查看
#7楼
[
楼主
]
2006-11-04 09:09
|
福娃
我已经测试通过了,你们看看
http://www.cnblogs.com/maplye/archive/2006/11/04/549773.html
注册用户登录后才能发表评论,请
登录
或
注册
,
返回博客园首页
。
首页
博问
闪存
新闻
园子
招聘
知识库
最新IT新闻
:
·
最想要的Entity Framework功能
·
专访Jeffrey Richter:Windows 8是微软的重中之重
·
《福布斯》:谷歌进军硬件产品 难撼动苹果地位
·
美国空军拟最多购买1.8万台iPad 2
·
分析称专利之争让谷歌苹果两败俱伤
»
更多新闻...
最新知识库文章
:
·
高级编程语言的发展历程
·
如何学习一门新的编程语言?
·
学习不同编程语言的重要性
·
为什么我喜欢富于表达性的编程语言
·
计算机专业的女生为什么要学编程
»
更多知识库文章...
China-pub 2011秋季教材巡展
China-Pub 计算机绝版图书按需印刷服务
公告
昵称:
福娃
园龄:
6年2个月
粉丝:
1
关注:
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
搜索
常用链接
我的随笔
我的评论
我的参与
最新评论
我的标签
更多链接
随笔分类
.NET 2.0(8)
(rss)
Castle(9)
(rss)
Django(7)
(rss)
IBatis.Net(10)
(rss)
J2EE开发(1)
(rss)
Python(4)
(rss)
Windows Workflow Foundation(5)
(rss)
每日记录(8)
(rss)
随笔档案
2007年10月 (1)
2007年2月 (2)
2007年1月 (1)
2006年12月 (4)
2006年11月 (4)
2006年9月 (9)
2006年8月 (2)
2006年7月 (8)
2006年6月 (6)
2006年5月 (8)
2006年4月 (5)
2006年3月 (7)
文章分类
Django(1)
(rss)
相册
小呆
Well Blog
Paul Wilson
WilsonORMapper Creator
博客组
henryfan
Jejwe的博客
NewDraw
SHY520
最新评论
阅读排行榜
评论排行榜
推荐排行榜