自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

iBATIS教程之如何獲得output參數(shù)值

開發(fā) 后端
iBATIS教程之如何獲得output參數(shù)值主要向你介紹如何在iBATIS.NET存儲(chǔ)過程中獲得output值。

最近有人問我怎么在存儲(chǔ)過程中獲取output的參數(shù)值,由于我最近沒有用iBATIS.NET,所以就從文檔中找到的param的XML,也就沒有在意,但后來有人說調(diào)不通,今天早上又收到一份留言,所以我早上作了測(cè)試!也出現(xiàn)獲取不到數(shù)據(jù)的問題,但***還是解決了!我的測(cè)試環(huán)境是sqlserver2005/vs2005/ibatis.net2.0

如下:

Procedure:

  1. create proc sp_output  
  2. (  
  3.     @testParam    int    output  
  4. )  
  5. as  
  6. begin  
  7.     set @testParam = 10 
  8. end  
  9. go 

XML:

  1. ﹤parameterMaps﹥  
  2.   ﹤parameterMap id="select-params2" class="Hashtable"﹥  
  3.     ﹤parameter property="testParam" column="testParam" direction="Output" /﹥  
  4.   ﹤/parameterMap﹥  
  5. ﹤/parameterMaps﹥  
  6.  
  7. ﹤statements﹥  
  8.  
  9.   ﹤procedure id="GetAccountViaSP2" parameterMap="select-params2"﹥  
  10.     sp_output  
  11.   ﹤/procedure﹥  
  12. ﹤/statements﹥ 

Code:

  1. int testid = 0;  
  2. Hashtable map = new Hashtable();  
  3. map.Add("testParam", testid);  
  4.  
  5. mapper.Insert("GetAccountViaSP2", map);  
  6.  
  7. Console.WriteLine(map["testParam"].ToString()); 

注意,在parammap定義的時(shí)候需要設(shè)置class=Hashtable,用class=int,就獲取不到!

iBATIS教程之如何獲得output參數(shù)值就向你介紹到這里,希望對(duì)你有所幫助。

【編輯推薦】

  1. iBATIS中添加DAO的配置淺析
  2. iBATIS DAO framework初體驗(yàn)
  3. iBATIS教程之快速入門淺析
  4. iBATIS教程之like語句的寫法淺析
  5. iBATIS.NET多數(shù)據(jù)庫支持淺析
責(zé)任編輯:仲衡 來源: cnblogs
相關(guān)推薦

2009-07-17 09:44:40

iBATIS教程

2009-07-21 14:24:46

iBATIS教程

2009-07-21 15:05:43

2009-07-22 16:02:14

iBATIS參數(shù)

2024-07-26 08:53:09

前端參數(shù)后端

2009-07-22 13:32:43

iBATIS DAO

2013-05-24 10:22:07

Python默認(rèn)參數(shù)值

2009-07-27 09:20:35

硬編碼參數(shù)

2011-06-30 10:36:22

JSF

2011-07-21 08:43:38

2011-06-30 10:49:27

2009-09-28 11:21:17

Linux教程ls命令Linux

2017-07-18 10:14:23

OracleMerge into教程

2009-09-25 10:06:37

Linux教程Linux pwdLinux命令

2010-04-27 12:29:08

Linux負(fù)載均衡

2009-09-25 10:08:24

Linux教程Linux cdLinux命令

2011-07-21 10:17:53

java

2009-09-28 11:19:45

Linux教程dir命令Linux

2009-10-21 17:03:05

VB實(shí)例教程

2009-07-21 16:49:41

整合iBatis和SpSqlMapClien
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)