zoukankan      html  css  js  c++  java
  • Cache使用方法1

    代码
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using ypxt.IDAL;
    using System.Data;
    using System.Data.SqlClient;
    using ypxt.MODEL;
    using ypxt.DBUtility;
    namespace ypxt.SQLDAL
    {
      
    public  class DALKey: IKey
        {
            
    private const string PARM_KeyId = "@KeyId";
            
    private const string PARM_KeyText = "@KeyText";
            
    private const string PARM_AdverId = "@AdverId";
            
    private const string PARM_Money = "@Money";

            
    private const string ADD_Keyinfo = "Insert into Key(KeyText,AdverId,Money) values(" + PARM_KeyText + "," + PARM_AdverId + "," + PARM_Money + ")";
            
    private const string UPDATE_Keyinfo = "UPDATE Key SET KeyText=" + PARM_KeyText + ",AdverId=" + PARM_AdverId + ",Money=" + PARM_Money + " WHERE CorpId=" + PARM_KeyId;
            
    private const string DELETE_KeyinfoByID = "DELETE FROM Key WHERE KeyId=" + PARM_KeyId;
            
    private const string SELECT_KeyinfoByID = "SELECT * FROM Key WHERE KeyId=" + PARM_KeyId;
            
    private const string SELECT_Keyinfo = "SELECT * FROM Key";
     
         
    /// 增加数据 ---郑
         #region 

            
    public bool addKeyinfo(Keyinfo Keyinfo)
           {
               SqlParameter[] param 
    = GetKeyinfoParameters();
               setKeyinfoParameters(param, Keyinfo);
               
    int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionString, CommandType.Text, ADD_Keyinfo, param);
               
    if (result == 0)
               {
                   
    return false;
               }
               
    return true;
           }
            
    public static SqlParameter[] GetKeyinfoParameters()
            {
                
    //从缓存里面取参数,如果缓存里面没有参数,就将 参数加入缓存里面,,)
                SqlParameter[] param = SqlHelper.GetCachedParameters(ADD_Keyinfo);//.GetCachedParameters(ADD_MEMBERINFO);//从缓存里面取数据
                
    //将参数加入缓存里面
                if (param == null)
                {
                    
    /// 创建各个参数
                    param = new SqlParameter[]{
                     
    new SqlParameter(PARM_KeyText,SqlDbType.NVarChar,50),
                     
    new SqlParameter(PARM_AdverId,SqlDbType.Int,30),
                     
    new SqlParameter(PARM_Money,SqlDbType.Decimal,30)                
                    };
                    
    //放入缓存
                    SqlHelper.CacheParameters(ADD_Keyinfo, param);
                }
                
    return param;
            }

            
    public static void setKeyinfoParameters(SqlParameter[] parms, Keyinfo Keyinfo)
            {
                parms[
    0].Value = Keyinfo.KeyText;
                parms[
    1].Value = Keyinfo.AdverId;
                parms[
    2].Value = Keyinfo.Money;
               
            }
           
    #endregion
           
    #region      
            
    public bool updateKeyinfo(Keyinfo Keyinfo)
          {
              
    return true;
          }
           
    #endregion
            
    public bool deleteKeyinfo(int KeyinfoID)
          {
              
    return true;
          }
     
        }
    }
  • 相关阅读:
    ABAP 获取当天的上一个工作日或下一个工作日
    ABAP 增强实战:Enhancement Implementation增强点实施例子
    ABAP Alv输出金额字段时,需要按国家的货币格式显示,列如:JPY
    ABAP 调用程序时获取的数量,金额和日期字段会出现 逗号,-,负号等非法字段,所需要进行转化
    ABAP 调用标准报表程序,获取程序输出list
    ABAP Alv Varient问题:可以更改alv字段布局然后存到Varient中
    ABAP 向下取整和向上取整及取余数
    传统视觉处理方法笔记
    图像特征与描述笔记
    图像预处理笔记
  • 原文地址:https://www.cnblogs.com/muer/p/1724684.html
Copyright © 2011-2022 走看看