zoukankan      html  css  js  c++  java
  • 在.net中接收存储过程返回的值

     getCon(); //连接数据库的方法
            int id = 35;
            SqlParameter[] par 
    = new SqlParameter[2];
            par[
    0= new SqlParameter("@id", SqlDbType.Int);
            par[
    0].Value = id;
            par[
    1= new SqlParameter("@count", SqlDbType.Int);  
            par[
    1].Direction = ParameterDirection.Output; //设置为输出参数
            SqlHelper.ExecuteNonQuery(con, CommandType.StoredProcedure,
                
    "getChildCount", par);

            
    this.Label1.Text = par[1].Value.ToString(); //接收输出的参数
    存储过程代码如下:
    create proc getChildCount
    @id int,
    @count int output
    as 
     
    select @count=babycount from yangsCMS_Article_Class where id=@id order by treekey
  • 相关阅读:
    NOIP2018游记-DAY1
    NOIP2018游记-DAY0
    18.11.7绍一模拟赛
    [SPOJ]SELTEAM
    18.11.5绍一模拟赛
    18.11.2绍一模拟赛
    [模拟赛]世界杯
    [模拟赛]路途
    乘法逆元的研究
    子查询,TOP_N,分页,行转列
  • 原文地址:https://www.cnblogs.com/yangbin1005/p/989865.html
Copyright © 2011-2022 走看看