zoukankan      html  css  js  c++  java
  • SQL Server 输出参数OUTPUT

    ALTER PROCEDURE [dbo].[SearchActivity]
    (
          @Counts int = 0 OUTPUT  
    )
    AS
    SET NOCOUNT ON;

    ….

    public static DataSet Search(ref int Counts)
            {
                    string strConnect = CoBro.Common.AppConfig.ConnectString;
                    SqlConnection sqlConnection = new SqlConnection(strConnect);
                    SqlDataAdapter da = new SqlDataAdapter();

                    SqlCommand cmd = new SqlCommand("SearchActivity", sqlConnection);
                    cmd.CommandType = CommandType.StoredProcedure;
                    da.SelectCommand = cmd;
                    SqlParameter para;               

                    para = cmd.Parameters.Add("@Counts", SqlDbType.Int);
                    para.Direction = ParameterDirection.Output;

                    DataSet ds = new DataSet();
                    da.Fill(ds);
                    Counts = Convert.ToInt32(cmd.Parameters["@Counts"].Value);
                    sqlConnection.Close();
                    return ds;             
            }

  • 相关阅读:
    Servlet学习小结
    HTTP学习小结
    SpringMVC第二天
    使用Servlet 编写过滤器
    项目使用框架
    java-web
    SSM框架集成.下(供自己练习查阅用)
    SSM框架集成.中(供自己练习查阅用)
    SSM框架集成.上(供自己练习查阅用)
    debug
  • 原文地址:https://www.cnblogs.com/emanlee/p/1649498.html
Copyright © 2011-2022 走看看