亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? sqlhelper.cs

?? 使用工具為.net2003
?? CS
?? 第 1 頁 / 共 5 頁
字號:
//===============================================================================
// Microsoft Data Access Application Block for .NET
// http://msdn.microsoft.com/library/en-us/dnbda/html/daab-rm.asp
//
// SQLHelper.cs
//
// This file contains the implementations of the SqlHelper and SqlHelperParameterCache
// classes.
//
// For more information see the Data Access Application Block Implementation Overview. 
// 
//===============================================================================
// Copyright (C) 2000-2001 Microsoft Corporation
// All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
// FITNESS FOR A PARTICULAR PURPOSE.
//==============================================================================

using System;
using System.Data;
using System.Xml;
using System.Data.SqlClient;
using System.Collections;


namespace Microsoft.ApplicationBlocks.Data
{
	/// <summary>
	/// The SqlHelper class is intended to encapsulate high performance, scalable best practices for 
	/// common uses of SqlClient.
	/// </summary>
	public sealed class SqlHelper
	{
		#region private utility methods & constructors

		//Since this class provides only static methods, make the default constructor private to prevent 
		//instances from being created with "new SqlHelper()".
		private SqlHelper() {}



		/// <summary>
		/// This method is used to attach array of SqlParameters to a SqlCommand.
		/// 
		/// This method will assign a value of DbNull to any parameter with a direction of
		/// InputOutput and a value of null.  
		/// 
		/// This behavior will prevent default values from being used, but
		/// this will be the less common case than an intended pure output parameter (derived as InputOutput)
		/// where the user provided no input value.
		/// </summary>
		/// <param name="command">The command to which the parameters will be added</param>
		/// <param name="commandParameters">an array of SqlParameters tho be added to command</param>
		private static void AttachParameters(SqlCommand command, SqlParameter[] commandParameters)
		{
			foreach (SqlParameter p in commandParameters)
			{
				//check for derived output value with no value assigned
				if ((p.Direction == ParameterDirection.InputOutput) && (p.Value == null))
				{
					p.Value = DBNull.Value;
				}
				
				command.Parameters.Add(p);
			}
		}

		/// <summary>
		/// This method assigns an array of values to an array of SqlParameters.
		/// </summary>
		/// <param name="commandParameters">array of SqlParameters to be assigned values</param>
		/// <param name="parameterValues">array of objects holding the values to be assigned</param>
		private static void AssignParameterValues(SqlParameter[] commandParameters, object[] parameterValues)
		{
			if ((commandParameters == null) || (parameterValues == null)) 
			{
				//do nothing if we get no data
				return;
			}

			// we must have the same number of values as we pave parameters to put them in
			if (commandParameters.Length != parameterValues.Length)
			{
				throw new ArgumentException("Parameter count does not match Parameter Value count.");
			}

			//iterate through the SqlParameters, assigning the values from the corresponding position in the 
			//value array
			for (int i = 0, j = commandParameters.Length; i < j; i++)
			{
				commandParameters[i].Value = parameterValues[i];
			}
		}

		/// <summary>
		/// This method opens (if necessary) and assigns a connection, transaction, command type and parameters 
		/// to the provided command.
		/// </summary>
		/// <param name="command">the SqlCommand to be prepared</param>
		/// <param name="connection">a valid SqlConnection, on which to execute this command</param>
		/// <param name="transaction">a valid SqlTransaction, or 'null'</param>
		/// <param name="commandType">the CommandType (stored procedure, text, etc.)</param>
		/// <param name="commandText">the stored procedure name or T-SQL command</param>
		/// <param name="commandParameters">an array of SqlParameters to be associated with the command or 'null' if no parameters are required</param>
		private static void PrepareCommand(SqlCommand command, SqlConnection connection, SqlTransaction transaction, CommandType commandType, string commandText, SqlParameter[] commandParameters)
		{
			//if the provided connection is not open, we will open it
			if (connection.State != ConnectionState.Open)
			{
				connection.Open();
			}

			//associate the connection with the command
			command.Connection = connection;

			//set the command text (stored procedure name or SQL statement)
			command.CommandText = commandText;

			//if we were provided a transaction, assign it.
			if (transaction != null)
			{
				command.Transaction = transaction;
			}

			//set the command type
			command.CommandType = commandType;

			//attach the command parameters if they are provided
			if (commandParameters != null)
			{
				AttachParameters(command, commandParameters);
			}

			return;
		}


		#endregion private utility methods & constructors

		#region ExecuteNonQuery

		/// <summary>
		/// Execute a SqlCommand (that returns no resultset and takes no parameters) against the database specified in 
		/// the connection string. 
		/// </summary>
		/// <remarks>
		/// e.g.:  
		///  int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders");
		/// </remarks>
		/// <param name="connectionString">a valid connection string for a SqlConnection</param>
		/// <param name="commandType">the CommandType (stored procedure, text, etc.)</param>
		/// <param name="commandText">the stored procedure name or T-SQL command</param>
		/// <returns>an int representing the number of rows affected by the command</returns>
		public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText)
		{
			//pass through the call providing null for the set of SqlParameters
			return ExecuteNonQuery(connectionString, commandType, commandText, (SqlParameter[])null);
		}

		/// <summary>
		/// Execute a SqlCommand (that returns no resultset) against the database specified in the connection string 
		/// using the provided parameters.
		/// </summary>
		/// <remarks>
		/// e.g.:  
		///  int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));
		/// </remarks>
		/// <param name="connectionString">a valid connection string for a SqlConnection</param>
		/// <param name="commandType">the CommandType (stored procedure, text, etc.)</param>
		/// <param name="commandText">the stored procedure name or T-SQL command</param>
		/// <param name="commandParameters">an array of SqlParamters used to execute the command</param>
		/// <returns>an int representing the number of rows affected by the command</returns>
		public static int ExecuteNonQuery(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
		{
			//create & open a SqlConnection, and dispose of it after we are done.
			using (SqlConnection cn = new SqlConnection(connectionString))
			{
				cn.Open();

				//call the overload that takes a connection in place of the connection string
				return ExecuteNonQuery(cn, commandType, commandText, commandParameters);
			}
		}

		/// <summary>
		/// Execute a stored procedure via a SqlCommand (that returns no resultset) against the database specified in 
		/// the connection string using the provided parameter values.  This method will query the database to discover the parameters for the 
		/// stored procedure (the first time each stored procedure is called), and assign the values based on parameter order.
		/// </summary>
		/// <remarks>
		/// This method provides no access to output parameters or the stored procedure's return value parameter.
		/// 
		/// e.g.:  
		///  int result = ExecuteNonQuery(connString, "PublishOrders", 24, 36);
		/// </remarks>
		/// <param name="connectionString">a valid connection string for a SqlConnection</param>
		/// <param name="spName">the name of the stored prcedure</param>
		/// <param name="parameterValues">an array of objects to be assigned as the input values of the stored procedure</param>
		/// <returns>an int representing the number of rows affected by the command</returns>
		public static int ExecuteNonQuery(string connectionString, string spName, params object[] parameterValues)
		{
			//if we receive parameter values, we need to figure out where they go
			if ((parameterValues != null) && (parameterValues.Length > 0)) 
			{
				//pull the parameters for this stored procedure from the parameter cache (or discover them & populate the cache)
				SqlParameter[] commandParameters = SqlHelperParameterCache.GetSpParameterSet(connectionString, spName);

				//assign the provided values to these parameters based on parameter order
				AssignParameterValues(commandParameters, parameterValues);

				//call the overload that takes an array of SqlParameters
				return ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName, commandParameters);
			}
				//otherwise we can just call the SP without params
			else 
			{
				return ExecuteNonQuery(connectionString, CommandType.StoredProcedure, spName);
			}
		}

		/// <summary>
		/// Execute a SqlCommand (that returns no resultset and takes no parameters) against the provided SqlConnection. 
		/// </summary>
		/// <remarks>
		/// e.g.:  
		///  int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, "PublishOrders");
		/// </remarks>
		/// <param name="connection">a valid SqlConnection</param>
		/// <param name="commandType">the CommandType (stored procedure, text, etc.)</param>
		/// <param name="commandText">the stored procedure name or T-SQL command</param>
		/// <returns>an int representing the number of rows affected by the command</returns>
		public static int ExecuteNonQuery(SqlConnection connection, CommandType commandType, string commandText)
		{
			//pass through the call providing null for the set of SqlParameters
			return ExecuteNonQuery(connection, commandType, commandText, (SqlParameter[])null);
		}

		/// <summary>
		/// Execute a SqlCommand (that returns no resultset) against the specified SqlConnection 
		/// using the provided parameters.
		/// </summary>
		/// <remarks>
		/// e.g.:  
		///  int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));
		/// </remarks>
		/// <param name="connection">a valid SqlConnection</param>
		/// <param name="commandType">the CommandType (stored procedure, text, etc.)</param>
		/// <param name="commandText">the stored procedure name or T-SQL command</param>
		/// <param name="commandParameters">an array of SqlParamters used to execute the command</param>
		/// <returns>an int representing the number of rows affected by the command</returns>
		public static int ExecuteNonQuery(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
		{	
			//create a command and prepare it for execution
			SqlCommand cmd = new SqlCommand();
			PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters);
			
			//finally, execute the command.
			int retval = cmd.ExecuteNonQuery();

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人黄色影院| 国产91在线|亚洲| 国产91丝袜在线18| 欧美日韩国产综合一区二区三区| 日韩欧美在线一区二区三区| 亚洲视频在线观看一区| 国内精品伊人久久久久av一坑| 91久久精品国产91性色tv| 精品电影一区二区| 日韩一区精品字幕| 日本道在线观看一区二区| 久久先锋影音av| 奇米精品一区二区三区四区| 在线看国产一区二区| 日韩理论片在线| 成人一区二区三区在线观看| 7777精品久久久大香线蕉| 一区二区三区蜜桃网| 成人性视频免费网站| 国产拍揄自揄精品视频麻豆| 免费的成人av| 日韩精品一区二区在线观看| 性欧美大战久久久久久久久| 欧美三级欧美一级| 亚洲第一福利视频在线| 欧美性欧美巨大黑白大战| 亚洲美女偷拍久久| 在线免费观看日本一区| 亚洲欧美电影一区二区| 99精品欧美一区| 中文字幕中文字幕中文字幕亚洲无线| 国产成人在线视频网站| 欧美精品一区二区三区很污很色的| 奇米色777欧美一区二区| 日韩三级中文字幕| 免费成人在线影院| 26uuu欧美| 成人性生交大片免费看在线播放 | 石原莉奈在线亚洲二区| 91黄色免费网站| 亚洲国产精品久久人人爱| 欧美精品久久天天躁| 婷婷夜色潮精品综合在线| 欧美一级二级三级乱码| 久久成人羞羞网站| 国产拍欧美日韩视频二区| 99v久久综合狠狠综合久久| 最新高清无码专区| 欧美日韩高清在线播放| 久久国产福利国产秒拍| 欧美高清在线一区二区| 色综合天天做天天爱| 亚洲电影中文字幕在线观看| 欧美不卡一二三| 成人妖精视频yjsp地址| 亚洲一区二区在线观看视频 | 99re成人精品视频| 亚洲成人av在线电影| 日韩欧美一卡二卡| 波多野结衣中文字幕一区| 午夜精品久久久久影视| 久久久噜噜噜久久中文字幕色伊伊 | 国产一区中文字幕| 中文字幕在线观看一区二区| 欧美日韩国产123区| 国产一区二区三区最好精华液| 国产精品乱人伦中文| 欧美系列亚洲系列| 国产精品1区2区| 亚洲国产色一区| 久久综合九色综合97婷婷| 在线免费亚洲电影| 国产在线播放一区二区三区| 亚洲人成亚洲人成在线观看图片| 制服.丝袜.亚洲.另类.中文| 不卡电影一区二区三区| 蜜臀久久99精品久久久画质超高清 | 亚洲国产精品一区二区久久恐怖片 | 欧美无砖砖区免费| 亚洲一区中文在线| 国产欧美一区二区精品秋霞影院| 91成人免费在线视频| 国产不卡视频在线播放| 奇米精品一区二区三区在线观看| 亚洲欧洲精品一区二区三区| 日韩女优制服丝袜电影| 欧美午夜精品一区二区蜜桃| 成人激情开心网| 久久se这里有精品| 日韩激情在线观看| 亚洲永久免费av| 亚洲欧美日韩久久| 久久久久9999亚洲精品| 91精品欧美一区二区三区综合在| 99视频精品在线| 成人精品免费看| 国产综合色视频| 美女国产一区二区三区| 午夜在线成人av| 一区二区三区不卡在线观看| 中文字幕精品—区二区四季| 亚洲精品一区二区三区福利 | 日本欧美一区二区三区| 一区二区三区欧美激情| 亚洲欧美精品午睡沙发| 国产精品久久精品日日| 久久久精品影视| 久久久亚洲国产美女国产盗摄 | 中文字幕一区在线观看视频| 国产亚洲人成网站| www欧美成人18+| 久久久久久久国产精品影院| 久久久久综合网| 国产日韩三级在线| 国产拍欧美日韩视频二区| 欧美国产精品中文字幕| 中文在线免费一区三区高中清不卡| 久久综合九色综合97婷婷女人 | 国产精品综合二区| 国产一区二区伦理| 国v精品久久久网| 99re在线视频这里只有精品| 不卡视频一二三| 欧美中文字幕一二三区视频| 色综合色综合色综合色综合色综合 | 依依成人精品视频| 亚洲sss视频在线视频| 五月天亚洲精品| 久久疯狂做爰流白浆xx| 高清视频一区二区| 色综合久久中文综合久久97| 91久久国产最好的精华液| 欧美美女一区二区在线观看| 日韩欧美在线一区二区三区| 国产三级一区二区| 亚洲色图第一区| 日韩av高清在线观看| 激情欧美一区二区| 99久久精品久久久久久清纯| 欧美性高清videossexo| 精品日韩一区二区| 中文字幕日本乱码精品影院| 一区二区三区资源| 蜜臀精品久久久久久蜜臀| 国产91综合网| 欧美精品久久天天躁| 国产欧美在线观看一区| 亚洲成人久久影院| 国产麻豆精品在线观看| 色悠悠久久综合| 欧美岛国在线观看| 亚洲麻豆国产自偷在线| 青青草精品视频| 色八戒一区二区三区| 日韩精品中文字幕一区二区三区| 国产精品久久久久久久裸模| 日韩在线播放一区二区| 成人性色生活片| 日韩午夜在线影院| 亚洲人精品午夜| 国产一区二区剧情av在线| 91黄色小视频| 国产精品色一区二区三区| 日韩av不卡在线观看| 色婷婷久久一区二区三区麻豆| 欧美mv日韩mv| 亚洲大型综合色站| 波多野结衣在线一区| 欧美www视频| 午夜精品久久久久久久蜜桃app| 懂色一区二区三区免费观看| 欧美一级一级性生活免费录像| 国产精品国产自产拍高清av | 亚洲v中文字幕| 在线免费观看日本一区| 中文字幕精品一区| 国产综合久久久久影院| 在线成人小视频| 一区二区三区四区在线播放| 丁香一区二区三区| 精品999久久久| 日本成人中文字幕| 欧美少妇bbb| 一区二区三区四区乱视频| 99re热视频这里只精品 | 欧美xxx久久| 日韩avvvv在线播放| 欧美另类一区二区三区| 一区二区三区影院| 色综合天天综合网天天看片| 国产精品网曝门| 高清久久久久久| 欧美国产亚洲另类动漫| 国产成人在线电影| 久久精品视频网| 国产成人精品影院| 日本一区二区成人在线| 高清久久久久久| 综合久久给合久久狠狠狠97色| 波多野结衣在线aⅴ中文字幕不卡|