福娃
博客园
社区
首页
新随笔
联系
管理
订阅
随笔- 57 文章- 2 评论- 190
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
福娃
阅读(2086)
评论(11)
编辑
收藏
所属分类:
IBatis.Net
发表评论
回复
引用
#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
新用户注册
刷新评论列表
标题
姓名
主页
Email
(博主才能看到)
验证码
*
看不清,换一张
[
登录
][
注册
]
内容(请不要发表任何与政治相关的内容)
网站首页
新闻频道
社区
小组
博问
网摘
闪存
找找看
Remember Me?
登录
使用高级评论
新用户注册
返回页首
恢复上次提交
[使用Ctrl+Enter键可以直接提交]
该文被作者在 2006-04-26 18:06 编辑过
"五向定位"职业成长路线公开课(上海、南京、大连)
Google站内搜索
相关文章:
.NET设计模式系列文章
使用Visual Studio2005入门.Net2.0系列视频教程
相关链接:
所属分类的其他文章:
IBatis.Net如何支持多个数据库
IBatis.Net中为什么Output的paramMap的class设置为int就获取不到值
IBatis.Net如何获取存储过程的Output的参数值
IBatis.Net怎么使用VS 2005来做单元测试
IBatis.Net系列-多参数的SQL语句的配置
IBatis.Net系列-Mapped Statements的语法
IBatis.Net系列 - Invalid SqlMap.config document. cause :Cannot load schema for the namespace ''
IBatisNet系列-执行存储过程
IBatisNet系列二-QuickStart篇
IBatisNet系列-介绍篇
最新IT新闻:
MySpace推自助广告平台MyAds
Facebook创始人:信息共享或存摩尔定律
微软承认Vista用户账户控制功能有问题
资本寒冬侵袭中国视频网站 营销春天或不远
金融风暴波及全球创业板 中国概念股难独善其身
<
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
最新评论
1. re: [Javascript]给Javascript中的Array添加Remove方法
thanks (shallin)
2. re: [转]音乐天堂 Music Heaven Vol.1 ~ Vol.36 的目录
在上大学的时候听过一首MUSIC HEAVEN老歌,歌曲的名字可能是where did all the good times go 记得部分的歌词是: when we live in the co... (datelee)
3. re: [转]音乐天堂 Music Heaven Vol.1 ~ Vol.36 的目录
看到这些,我眼泪都出来了。 (AlexLee27)
阅读排行榜
1. [转]音乐天堂 Music Heaven Vol.1 ~ Vol.36 的目录(6174)
2. MonoRail学习-入门实例篇(4876)
3. MonoRail学习-介绍篇(4694)
4. IBatisNet系列二-QuickStart篇(2951)
5. IBatis.Net系列-多参数的SQL语句的配置(2706)
评论排行榜
1. MonoRail学习-入门实例篇(22)
2. Asp.Net中NHiernate的Session的管理(17)
3. [转]音乐天堂 Music Heaven Vol.1 ~ Vol.36 的目录(14)
4. IBatis.Net如何获取存储过程的Output的参数值(13)
5. IBatis.Net中为什么Output的paramMap的class设置为int就获取不到值(11)