zoukankan      html  css  js  c++  java
  • c#中获取存储过程的返回值(return Value)

    string connStr = "server=kofo;database=pubs;uid=sa;pwd=kofo123";

                  SqlConnection myConnection = new SqlConnection(connStr);

                  try

                  {

                       myConnection.Open();

                       SqlCommand myCommand = new SqlCommand("TestRetValue",myConnection);

                       myCommand.CommandType = CommandType.StoredProcedure;

                       SqlParameter myParam = myCommand.Parameters.Add(new SqlParameter("@RETURN_VALUE",SqlDbType.Int,4));                 

                       myParam.Direction = ParameterDirection.ReturnValue;             

                       myCommand.ExecuteNonQuery();

                       int me = (int)myParam.Value;

                       MessageBox.Show(me.ToString());

                      

                  }

                  catch(Exception ex)

                  {

                       MessageBox.Show(ex.Message);

                  }

                  finally

                  {

                       myConnection.Close();

                  }


    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/mane_yao/archive/2010/04/22/5514181.aspx

  • 相关阅读:
    truncate删除一个分区,测试全局索引是否失效
    DG环境恢复同步遇到报错ORA-00353ORA-00334以及ORA-00600[2619], [47745]
    继承
    智能指针unique_ptr
    explicit
    编译安装python3
    Linux读写执行权限(-r、-w、-x)的真正含义
    nginx入门之编译安装
    vim
    1.yum下载 mysql及授权
  • 原文地址:https://www.cnblogs.com/mane/p/1830010.html
Copyright © 2011-2022 走看看