zoukankan      html  css  js  c++  java
  • 【Vegas原创】调用不带参数的procedure代码

    适合经常改变where子句的代码


    SQL:

    create proc procBP_Cost_UpdateCost
    as
    SELECT  a.ModelGroupID, a.ProductCost
    FROM   T_ProductCost AS a INNER JOIN
            T_BPCost 
    ON a.ModelGroupID = T_BPCost.ModelGroupID
    WHERE     EXISTS (
    SELECT   MAX(CONVERT(int, PCYear + PCMonth)) AS Version, ModelGroupID
    FROM     T_ProductCost
    GROUP BY ModelGroupID, ProductCostID
    HAVING  (MAX(CONVERT(int, PCYear + PCMonth)) = CONVERT(int, a.PCYear + a.PCMonth)) AND (a.CostCommit = 'Y'))



    后台:

    DataSet ds = db.GetDataSetbyProc("procBP_Cost_UpdateCost");
      public DataSet GetDataSetbyProc(string procName)
            {
                
    #region 注释
                
    /*********************************************\
                        *功能:
                            *    执行存储过程,返回DataSet
                         
                        *返回:    DataSet
                                    Vegas 2008 07 16
                    \*******************************************
    */
                
    #endregion
                SqlDataAdapter sda 
    = new SqlDataAdapter(procName, connStr);
                sda.SelectCommand.CommandType 
    = CommandType.StoredProcedure;
                DataSet ds 
    = new DataSet();
                sda.Fill(ds);
                
    return ds;
            }


  • 相关阅读:
    还是this的问题
    this的问题
    javascript深入理解js闭包
    立即执行函数: (function(){...})() 与 (function(){...}()) 有什么区别?
    java中的精度问题的处理
    51nod 1766 树上的最远点对——线段树
    CODE FESTIVAL 2017 qual B C
    bzoj 2144: 跳跳棋——倍增/二分
    洛谷八连测第一轮
    bzoj 2079: [Poi2010]Guilds——结论题
  • 原文地址:https://www.cnblogs.com/amadeuslee/p/3744485.html
Copyright © 2011-2022 走看看