• sqlHelper


    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Collections;

        
    /// <summary>
        
    /// The SqlHelper class is intended to encapsulate high performance, 
        
    /// scalable best practices for common uses of SqlClient.
        
    /// </summary>

        public abstract class SqlHelper
        
    {

            
    //Database connection strings
            public static readonly string strConnection = ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;
            
    //public static readonly string ConnectionStringInventoryDistributedTransaction = ConfigurationManager.ConnectionStrings["SQLConnString2"].ConnectionString;
            
    //public static readonly string ConnectionStringOrderDistributedTransaction = ConfigurationManager.ConnectionStrings["SQLConnString3"].ConnectionString;
            
    //public static readonly string ConnectionStringProfile = ConfigurationManager.ConnectionStrings["SQLProfileConnString"].ConnectionString;

            
    // Hashtable to store cached parameters
            private static Hashtable parmCache = Hashtable.Synchronized(new Hashtable());

            
    ExecuteNonQuery

            
    ExecuteReader

            
    ExecuteScalar

            
    ExecuteDataSet

            
    CacheParameters

            
    GetCachedParameters

            
    PrepareCommand

            
    #region AddSqlParas
            
    /**/
            private static SqlCommand AddSqlParas(SqlParameter[] SqlParas, string cmdText, CommandType cmdType, SqlConnection SqlDataConn)
            
    {
                SqlCommand SqlComm 
    = new SqlCommand(cmdText, SqlDataConn);
                SqlComm.CommandType 
    = cmdType;
                
    if (SqlParas != null)
                
    {
                    
    foreach (SqlParameter p in SqlParas)
                    
    {
                        SqlComm.Parameters.Add(p);
                    }

                }

                
    return SqlComm;
            }

            
    #endregion

        }

  • 相关阅读:
    软件命名规则
    从命令行git转到Tortoise
    如何让浏览器不解析html?
    说几点我觉得谷歌浏览器不好的地方
    移动端开发:使用jQuery Mobile还是Zepto
    开源许可证GPL、BSD、MIT、Mozilla、Apache和LGPL的区别
    给大家讲个故事,感受一下什么叫CF。不知道的请认真听。
    cmd中utf-8编码的问题
    web前端关于html转义符的常用js函数
    js实例分析JavaScript中的事件委托和事件绑定
  • 原文地址:https://www.cnblogs.com/zijinguang/p/1234769.html
Copyright © 2020-2023  润新知