zoukankan      html  css  js  c++  java
  • 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

        }

  • 相关阅读:
    安装rqalpha的日志
    从github上下载一个csv文件
    PyQt4 里的表格部件的使用方法: QTableWidget
    markdown里的多层次列表项
    打包python脚本为exe的坎坷经历, by pyinstaller方法
    Spyder docstrings文档字符串的标准
    Plot Candlestick Charts in Research of quantopian
    另类之将ipython notebook嵌入blog方法
    Jupyter Notebook Tutorial: Introduction, Setup, and Walkthrough
    爬虫视频讲座
  • 原文地址:https://www.cnblogs.com/zijinguang/p/1234769.html
Copyright © 2011-2022 走看看