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

  • 相关阅读:
    git
    centos7安装python3和ipython
    centos7 安装mysql5.7
    ceph-文件存储
    ceph-对象存储
    ceph-块存储客户端
    ceph-简介及安装(luminous)版
    centos7 kvm安装使用
    webpack多页面应用打包问题-新增页面打包JS影响旧有JS资源
    webpack4.0 babel配置遇到的问题
  • 原文地址:https://www.cnblogs.com/mane/p/1830010.html
Copyright © 2011-2022 走看看