亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
色综合咪咪久久| 亚洲国产毛片aaaaa无费看 | 高清成人免费视频| 中文字幕乱码久久午夜不卡| 国产一区二区福利| 国产精品的网站| 久久不见久久见免费视频7| 日韩一区二区中文字幕| 毛片av一区二区| 亚洲精品在线观看网站| 高清shemale亚洲人妖| 国产日韩精品一区二区三区| 成人激情午夜影院| 一区二区三区精品久久久| 欧美在线不卡视频| 免费成人结看片| 国产精品久99| 91精品国产91久久久久久一区二区 | 色综合久久久久| 日韩av在线发布| 久久久久久久电影| 欧美网站一区二区| 国产精品综合av一区二区国产馆| 国产精品素人一区二区| 91.麻豆视频| 99re热视频这里只精品| 免费观看久久久4p| 亚洲免费伊人电影| 精品国产乱码久久| 欧美色中文字幕| 国产成人av网站| 91久久精品一区二区三区| 日本sm残虐另类| 亚洲国产一区二区三区 | 国产欧美日韩在线| 欧美一区二区在线视频| 在线亚洲免费视频| 成人av免费在线观看| 国产久卡久卡久卡久卡视频精品| 亚洲成人一二三| 亚洲国产另类精品专区| 亚洲黄色性网站| 亚洲精品综合在线| 国产精品麻豆视频| 国产精品久久久久天堂| 亚洲国产精品精华液ab| 337p粉嫩大胆色噜噜噜噜亚洲 | 国产一区二区三区精品视频| 免费一区二区视频| 日韩福利视频网| 免费不卡在线观看| 韩国一区二区视频| 国产91在线|亚洲| 亚洲国产精品久久久久秋霞影院 | 亚洲精品ww久久久久久p站| 日韩限制级电影在线观看| 91久久精品一区二区| av一区二区三区黑人| 国产寡妇亲子伦一区二区| 久久av中文字幕片| 麻豆91在线播放免费| 狠狠色丁香婷婷综合久久片| 久久超碰97中文字幕| 欧美另类z0zxhd电影| 日韩三级中文字幕| 中文字幕第一区| 日本在线不卡一区| 成人午夜伦理影院| 56国语精品自产拍在线观看| 26uuu亚洲综合色欧美 | 亚洲自拍与偷拍| 国模套图日韩精品一区二区 | 精品午夜一区二区三区在线观看| 精油按摩中文字幕久久| eeuss国产一区二区三区| 欧美日韩亚洲综合一区二区三区| 久久久无码精品亚洲日韩按摩| 中文字幕一区二区三区在线不卡| k8久久久一区二区三区| 日韩精品一区二区三区swag| 亚洲欧美一区二区三区久本道91 | 日本一道高清亚洲日美韩| 国产精品一区专区| 欧美性受xxxx黑人xyx性爽| 精品国产乱码久久久久久免费 | 91成人在线精品| 久久久久久久久久久久久久久99| 亚洲第一成年网| 国产精品亚洲成人| 日韩午夜电影在线观看| 亚洲男人都懂的| 成人天堂资源www在线| 日韩天堂在线观看| 一区二区三区视频在线看| 国产精品一卡二卡| 欧美一区二区免费视频| 亚洲成国产人片在线观看| 成人精品在线视频观看| 久久久久97国产精华液好用吗| 久久久久久久久99精品| 精品一区二区三区免费观看| 97se亚洲国产综合自在线| 久久综合国产精品| 精品一区二区三区日韩| 欧美成人艳星乳罩| 午夜精品久久久久久久99水蜜桃| 99精品欧美一区二区三区小说| 国产视频一区不卡| 成人av网址在线| 91麻豆精品国产91| 午夜精品福利久久久| 欧美综合久久久| 亚洲精品视频免费看| 欧美伦理影视网| 另类小说综合欧美亚洲| 91精品国产综合久久精品图片| 日本欧美一区二区在线观看| 欧美三区免费完整视频在线观看| 粉嫩嫩av羞羞动漫久久久| 亚洲精品免费在线观看| 6080午夜不卡| 精品一区二区三区的国产在线播放| 91麻豆精品国产91久久久久久久久 | 欧美最新大片在线看| 亚洲一二三区视频在线观看| 日韩欧美一区电影| 99综合电影在线视频| 日韩电影在线一区二区三区| 久久美女艺术照精彩视频福利播放 | 色噜噜狠狠色综合中国| 美女免费视频一区二区| 中文字幕在线播放不卡一区| 欧美日韩国产成人在线免费| 国产伦精品一区二区三区免费迷 | 国产精品久久久久永久免费观看 | 国产风韵犹存在线视精品| 26uuu国产日韩综合| 美腿丝袜亚洲三区| 日韩欧美一区二区在线视频| 成人av先锋影音| 色国产综合视频| 欧美日韩国产不卡| 欧美老肥妇做.爰bbww| 一本色道久久综合精品竹菊| 岛国av在线一区| 床上的激情91.| 精品亚洲国内自在自线福利| 亚洲v日本v欧美v久久精品| 久久久久久久av麻豆果冻| 欧美日韩国产综合一区二区三区| 不卡免费追剧大全电视剧网站| 亚洲国产视频网站| 中文字幕av一区二区三区免费看 | 亚洲一区电影777| 亚洲444eee在线观看| 国产精品乱码妇女bbbb| 久久蜜臀精品av| 日韩欧美电影在线| 中文一区在线播放| 亚洲免费在线观看视频| 一区二区三区四区精品在线视频| 国产精品人妖ts系列视频| 亚洲青青青在线视频| 中文字幕一区在线| 亚洲国产精品久久人人爱蜜臀 | 色综合视频一区二区三区高清| 国产精品 日产精品 欧美精品| 亚洲大片在线观看| 日韩电影在线免费看| 国产精品亚洲综合一区在线观看| 国产iv一区二区三区| 51午夜精品国产| 中文字幕 久热精品 视频在线| 亚洲一区在线观看视频| 国产乱国产乱300精品| 欧美精品少妇一区二区三区| 日本一区二区免费在线观看视频 | 成人av午夜电影| 91久久精品午夜一区二区| 欧美视频在线不卡| 色综合天天综合网国产成人综合天| 欧美日韩mp4| 中文字幕日韩一区二区| 日本麻豆一区二区三区视频| 99久久久国产精品| 欧美日韩一区在线| 国产精品麻豆视频| 国产综合色精品一区二区三区| 欧洲国内综合视频| 亚洲国产精品av| 精品在线观看免费| 国产成人在线观看免费网站| 欧美日韩国产精品成人| 久久夜色精品国产噜噜av| 国产精品久线在线观看| 中文字幕乱码一区二区免费| 国产一区二区精品久久| 日韩亚洲欧美成人一区| 亚洲欧洲在线观看av| 成人h动漫精品|