1/1页1 跳转到查看:1578
发新话题 回复该主题

Ibatis 调用存储过程并接收存储过程返回的值

Ibatis 调用存储过程并接收存储过程返回的值

定义好存储过程的参数列表,并指定返回参数。

 
 
 
 
]
配置调用存储过程的XML标记:
 

 
 
 
 
]

调用页面的 C# 代码:

public string GetTradeCountByRegion(string regionID)
    {
        try
        {
            Hashtable ht = new Hashtable();

            if (!string.IsNullOrEmpty(regionID))
                ht.Add("RegionID", regionID);

            ht.Add("Status", "9");
            ht.Add("Total", 0);

            return GetTradeService().GetTradeCountByRegion(ht);
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }


调用Ibatis 返回输出参数数据:

public string GetTradeCountByRegion(Hashtable ht)
        {
            ExecuteQueryForList("Trade_Select_Count_Region", ht);

            return ht["Total"].ToString();
        }


调用很简单。[em]2[/em] 给新手参考。
点燃激情,传递梦想,放飞希望,为奥运喝彩,为世界歌唱.

TOP

 

thanks

TOP

 
1/1页1 跳转到
发表新主题 回复该主题