亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
韩国精品免费视频| 亚洲欧美日韩系列| 日韩一区二区电影在线| 欧美色综合影院| 色欧美片视频在线观看| 色综合久久九月婷婷色综合| 菠萝蜜视频在线观看一区| 麻豆专区一区二区三区四区五区| 亚洲黄色性网站| 亚洲五码中文字幕| 五月婷婷欧美视频| 日韩av午夜在线观看| 一区二区日韩av| 亚洲国产中文字幕在线视频综合| 亚洲三级电影网站| 日韩一区在线播放| 亚洲美女免费视频| 丝袜诱惑亚洲看片| 国产精品一二一区| 97久久精品人人爽人人爽蜜臀| 91丨九色丨蝌蚪丨老版| 在线看国产一区| 欧美一区二区在线观看| 久久亚洲一级片| 一区二区三区四区在线免费观看| 日韩电影免费在线| 国产大陆a不卡| 在线一区二区观看| 欧美v亚洲v综合ⅴ国产v| 国产精品乱码久久久久久| 亚洲成人一二三| 国产很黄免费观看久久| 欧美性感一类影片在线播放| 日韩一级精品视频在线观看| 日本一区二区三区高清不卡| 亚洲欧美日韩中文播放| 九色综合狠狠综合久久| 色噜噜狠狠成人网p站| 日韩欧美视频一区| 亚洲精品欧美二区三区中文字幕| 日韩精彩视频在线观看| 成人丝袜高跟foot| 51久久夜色精品国产麻豆| 国产精品三级av在线播放| 亚洲综合网站在线观看| 国内精品国产成人国产三级粉色| 99久久伊人久久99| 亚洲精品在线三区| 视频一区视频二区中文字幕| 豆国产96在线|亚洲| 在线观看国产91| 国产精品网站一区| 国产在线播放一区三区四| 欧美色窝79yyyycom| 综合久久一区二区三区| 国产成人av自拍| 精品国产三级电影在线观看| 亚洲18影院在线观看| 色诱视频网站一区| 亚洲欧洲成人精品av97| 奇米在线7777在线精品| 色哟哟国产精品| 国产精品卡一卡二卡三| 国产成人在线视频免费播放| 欧美精品日韩一本| 一区二区三区在线播放| 日本韩国欧美在线| 中文av一区二区| 国产精品亚洲人在线观看| 欧美老女人第四色| 亚洲综合在线视频| 日本高清不卡视频| 亚洲欧美一区二区三区极速播放 | 国产精品乱码人人做人人爱| 天堂一区二区在线| 欧美日韩亚洲综合在线 | 久久婷婷国产综合精品青草| 午夜日韩在线电影| 欧美亚洲动漫另类| 亚洲国产一区在线观看| 欧美日韩午夜在线| 亚洲成人先锋电影| 日韩欧美中文字幕一区| 精彩视频一区二区| 中文字幕乱码一区二区免费| 国产精品1区2区3区| 中文字幕中文乱码欧美一区二区| av亚洲精华国产精华精华| 亚洲国产高清在线观看视频| 成人国产精品免费| 亚洲嫩草精品久久| 欧美色综合天天久久综合精品| 日韩中文字幕区一区有砖一区| 日韩一区二区三区在线观看| 麻豆精品视频在线观看免费| 国产日韩v精品一区二区| 成人高清免费观看| 亚洲mv在线观看| 久久亚洲精精品中文字幕早川悠里| 粉嫩嫩av羞羞动漫久久久| 亚洲一区二区三区四区五区黄| 777午夜精品视频在线播放| 视频在线观看91| 国产欧美日韩中文久久| 欧美主播一区二区三区美女| 亚洲午夜激情网站| 久久精品人人做人人综合| 日本久久一区二区| 国产在线精品不卡| 亚洲美女在线国产| www国产精品av| 日本乱人伦一区| 国产福利视频一区二区三区| 亚洲自拍偷拍麻豆| 国产日韩在线不卡| 91精品国产综合久久久久久久| 成人网在线播放| 午夜不卡av在线| 国产精品久久久久影院亚瑟| 欧美丝袜丝交足nylons| 国产成人在线免费| 蜜桃一区二区三区在线| 亚洲欧美国产三级| 国产日韩欧美精品综合| 91精品国产一区二区三区蜜臀 | 人人狠狠综合久久亚洲| 国产精品三级av| 777午夜精品免费视频| 波多野结衣亚洲| 美女一区二区在线观看| 精品久久久久久久一区二区蜜臀| av电影在线观看完整版一区二区| 日韩和欧美一区二区三区| 亚洲精品大片www| 2024国产精品| 欧美一区在线视频| 欧美日韩亚洲另类| 99精品欧美一区二区蜜桃免费 | 国产成人综合在线播放| 蜜桃av噜噜一区| 性做久久久久久免费观看欧美| 久久精品水蜜桃av综合天堂| 日韩久久免费av| 欧美日韩成人一区| 色综合色狠狠天天综合色| 免播放器亚洲一区| 蜜桃一区二区三区四区| 午夜视频久久久久久| 一区二区免费在线| 亚洲人午夜精品天堂一二香蕉| 国产日韩欧美精品电影三级在线 | 99热这里都是精品| 成人免费视频播放| 成人精品国产免费网站| 国产麻豆午夜三级精品| 精品亚洲成a人| 黄一区二区三区| 首页国产丝袜综合| 日本在线不卡一区| 麻豆精品视频在线观看免费| 美女www一区二区| 奇米一区二区三区| 久久成人av少妇免费| 久久99最新地址| 国产麻豆视频一区二区| 成熟亚洲日本毛茸茸凸凹| 成人av高清在线| 色综合久久66| 欧美一级欧美三级在线观看| 91麻豆精品国产无毒不卡在线观看| 欧美区一区二区三区| 国产99久久久国产精品潘金| 波多野结衣中文字幕一区| 色婷婷久久久综合中文字幕| 99久久国产综合精品色伊| 91免费在线看| 91精品在线麻豆| 久久五月婷婷丁香社区| 国产精品毛片高清在线完整版| 日韩视频一区二区在线观看| 精品国产乱码久久久久久牛牛| 日韩精品一区二| 国产农村妇女精品| 亚洲永久精品国产| 狠狠色丁香婷婷综合久久片| 成人深夜福利app| 欧美日韩第一区日日骚| 久久精品免视看| 一区二区三区在线视频免费观看| 亚洲6080在线| 成人免费视频国产在线观看| 欧美久久一区二区| 国产日韩欧美电影| 日日夜夜精品视频天天综合网| 国产乱淫av一区二区三区| 99国产精品久久久| 2022国产精品视频| 亚洲精品高清在线观看| 成人免费视频视频| 日韩欧美亚洲国产精品字幕久久久|