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

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

?? sqlhelper.cs

?? C#代碼查看Sqlserver等不同數據庫的源代碼
?? 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一区二区三区免费野_久草精品视频
亚洲一区免费视频| 日韩高清在线观看| 午夜成人在线视频| 大美女一区二区三区| 在线观看欧美精品| 国产精品人成在线观看免费| 看片的网站亚洲| 色哟哟日韩精品| 国产精品美女久久久久aⅴ | 中文字幕中文字幕在线一区| 日韩精品成人一区二区三区 | 亚洲男人的天堂在线aⅴ视频| 奇米综合一区二区三区精品视频| 一本色道亚洲精品aⅴ| 国产人妖乱国产精品人妖| 日韩精品91亚洲二区在线观看| 日本高清不卡在线观看| 国产精品视频你懂的| 粉嫩aⅴ一区二区三区四区| 日韩视频一区在线观看| 婷婷综合五月天| 欧美日本免费一区二区三区| 亚洲精品国产无天堂网2021| zzijzzij亚洲日本少妇熟睡| 国产精品天干天干在线综合| 国产一区不卡在线| 欧美精品一区二区久久久| 日本va欧美va精品发布| 日韩欧美国产一区在线观看| 日韩高清在线观看| 91精品福利在线一区二区三区| 五月天中文字幕一区二区| 欧美主播一区二区三区美女| 亚洲摸摸操操av| 日本韩国视频一区二区| 一区二区三区精品久久久| 色婷婷av久久久久久久| 亚洲一区二区在线观看视频| 欧美亚洲综合在线| 日本不卡123| 久久香蕉国产线看观看99| 国产一区二区视频在线| 日本一区二区三区视频视频| 国产一区二三区| 日本一区二区三区dvd视频在线| 日韩一级大片在线观看| 91精品国产一区二区三区香蕉| 欧美国产一区视频在线观看| 日本女优在线视频一区二区 | 中文字幕免费在线观看视频一区| 午夜免费欧美电影| 成人高清免费在线播放| 懂色av中文一区二区三区| 久久一日本道色综合| 99久久综合色| 三级一区在线视频先锋| 337p粉嫩大胆噜噜噜噜噜91av| 国产麻豆日韩欧美久久| 亚洲欧洲三级电影| 3d成人动漫网站| 国产aⅴ精品一区二区三区色成熟| 亚洲人成网站色在线观看| 欧美妇女性影城| 国产一区二区成人久久免费影院| 国产精品久久毛片| 欧美日韩免费一区二区三区| 九色综合国产一区二区三区| 国产精品第四页| 欧美理论片在线| 国产精品77777| 午夜日韩在线电影| 国产欧美日韩另类一区| 欧美色电影在线| 岛国精品在线播放| 麻豆成人在线观看| 樱桃国产成人精品视频| 久久久久国产成人精品亚洲午夜| 91小宝寻花一区二区三区| 免费在线观看视频一区| 亚洲色图欧洲色图婷婷| 26uuu精品一区二区在线观看| 91视频xxxx| 国产毛片精品国产一区二区三区| 午夜电影久久久| 亚洲精品国久久99热| 久久九九影视网| 欧美一区二区美女| 欧美日韩dvd在线观看| 91视频免费看| 国产东北露脸精品视频| 美女视频一区二区| 亚洲成人激情自拍| 亚洲免费大片在线观看| 国产精品久久久久久久久搜平片| 日韩精品一区二区三区视频播放 | 成人av在线播放网址| 韩日av一区二区| 日本三级亚洲精品| 婷婷成人综合网| 午夜国产精品一区| 亚洲韩国精品一区| 亚洲男人天堂av| 亚洲精品中文字幕乱码三区 | 亚洲成av人在线观看| 最近日韩中文字幕| 色一情一乱一乱一91av| 国产精品不卡视频| 欧美一区二区私人影院日本| 懂色av一区二区三区蜜臀| 亚洲线精品一区二区三区| 日韩一区二区在线免费观看| 国产91精品露脸国语对白| 香蕉影视欧美成人| 国产丝袜欧美中文另类| 久久99热这里只有精品| 国模无码大尺度一区二区三区| 老司机精品视频一区二区三区| 美女在线观看视频一区二区| 久久99精品国产麻豆不卡| 久久99精品久久久久久| 国产露脸91国语对白| 成人午夜av影视| 色哟哟在线观看一区二区三区| av不卡在线观看| 在线视频你懂得一区| 欧美色大人视频| 日韩一区二区在线播放| 国产视频一区二区在线| 亚洲欧洲在线观看av| 亚洲一区二区三区四区在线观看| 日韩中文字幕1| 国内久久婷婷综合| 成人h动漫精品一区二区| 91浏览器打开| 日韩视频免费直播| 国产精品久久久久一区| 夜色激情一区二区| 美国毛片一区二区三区| 国产精品一区二区久久精品爱涩| 99久久精品免费看国产| 欧美日免费三级在线| 精品日韩欧美一区二区| 国产精品国产a| 天天色 色综合| 国产精品一区二区在线观看不卡 | 成人午夜短视频| 欧美日韩在线亚洲一区蜜芽| 精品卡一卡二卡三卡四在线| 国产日韩欧美不卡在线| 亚洲天堂免费看| 九九**精品视频免费播放| www.亚洲精品| 日韩欧美在线观看一区二区三区| 欧美高清在线视频| 亚洲va中文字幕| 成人国产精品免费| 日韩三级.com| 亚洲精品成人天堂一二三| 国内成人自拍视频| 欧美在线啊v一区| 久久久久久电影| 午夜国产精品一区| 99re亚洲国产精品| wwwwxxxxx欧美| 午夜精品久久久久影视| 不卡av在线免费观看| 欧美一区在线视频| 一区二区三区不卡视频在线观看| 国产精品一区二区在线看| 69堂国产成人免费视频| 亚洲免费观看在线视频| 国产福利不卡视频| 日韩精品一区二区三区视频在线观看| 国产精品高潮久久久久无| 欧美va亚洲va在线观看蝴蝶网| 欧美日韩高清影院| 精品国产1区2区3区| 中文字幕五月欧美| 性欧美大战久久久久久久久| 国产综合色在线视频区| 色婷婷亚洲精品| 日韩久久久精品| 欧美国产一区在线| 亚洲 欧美综合在线网络| 韩国av一区二区三区四区| 亚洲影院理伦片| 一本久久精品一区二区| 国产精品久久久久国产精品日日| 国产一区免费电影| 26uuu久久综合| 国产一区二区日韩精品| 久久免费看少妇高潮| 久久成人综合网| 精品日产卡一卡二卡麻豆| 青青草精品视频| 日韩一级大片在线| 精品一区二区三区在线播放视频| 91精品在线免费观看| 日本中文字幕一区二区有限公司| 欧美巨大另类极品videosbest|