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

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

?? sqlhelper.cs

?? 一套辦公系統源碼一套辦公系統源碼一套辦公系統源碼
?? CS
?? 第 1 頁 / 共 2 頁
字號:
//*********************************************************************
// 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.
//*********************************************************************
//該源碼下載自www.51aspx.com(51aspx.com)

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

namespace qminoa.DA
{
	//*********************************************************************
	//
	// The SqlHelper class is intended to encapsulate high performance, scalable best practices for 
	// common uses of SqlClient.
	//
	//*********************************************************************

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

		private SqlHelper() {}

		//*********************************************************************
		//
		// 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.
		// 
		// param name="command" The command to which the parameters will be added
		// param name="commandParameters" an array of SqlParameters tho be added to command
		//
		//*********************************************************************

		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);
			}
		}

		//*********************************************************************
		//
		// This method assigns an array of values to an array of SqlParameters.
		// 
		// param name="commandParameters" array of SqlParameters to be assigned values
		// param name="parameterValues" array of objects holding the values to be assigned
		//
		//*********************************************************************

		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];
			}
		}

		//*********************************************************************
		//
		// This method opens (if necessary) and assigns a connection, transaction, command type and parameters 
		// to the provided command.
		// 
		// param name="command" the SqlCommand to be prepared
		// param name="connection" a valid SqlConnection, on which to execute this command
		// param name="transaction" a valid SqlTransaction, or 'null'
		// param name="commandType" the CommandType (stored procedure, text, etc.)
		// param name="commandText" the stored procedure name or T-SQL command
		// param name="commandParameters" an array of SqlParameters to be associated with the command or 'null' if no parameters are required
		//
		//*********************************************************************

		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;
		}

		//*********************************************************************
		//
		// Execute a SqlCommand (that returns no resultset) against the database specified in the connection string 
		// using the provided parameters.
		//
		// e.g.:  
		//  int result = ExecuteNonQuery(connString, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));
		//
		// param name="connectionString" a valid connection string for a SqlConnection
		// param name="commandType" the CommandType (stored procedure, text, etc.)
		// param name="commandText" the stored procedure name or T-SQL command
		// param name="commandParameters" an array of SqlParamters used to execute the command
		// returns an int representing the number of rows affected by the command
		//
		//*********************************************************************

		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);
			}
		}

		//*********************************************************************
		//
		// 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.
		// 
		// 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);
		//
		// param name="connectionString" a valid connection string for a SqlConnection
		// param name="spName" the name of the stored prcedure
		// param name="parameterValues" an array of objects to be assigned as the input values of the stored procedure
		// returns an int representing the number of rows affected by the command
		//
		//*********************************************************************

		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);
			}
		}

		//*********************************************************************
		//
		// Execute a SqlCommand (that returns no resultset) against the specified SqlConnection 
		// using the provided parameters.
		// 
		// e.g.:  
		//  int result = ExecuteNonQuery(conn, CommandType.StoredProcedure, "PublishOrders", new SqlParameter("@prodid", 24));
		// 
		// param name="connection" a valid SqlConnection 
		// param name="commandType" the CommandType (stored procedure, text, etc.) 
		// param name="commandText" the stored procedure name or T-SQL command 
		// param name="commandParameters" an array of SqlParamters used to execute the command 
		// returns an int representing the number of rows affected by the command
		//
		//*********************************************************************

		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();
			
			// detach the SqlParameters from the command object, so they can be used again.
			cmd.Parameters.Clear();
			return retval;
		}

		//*********************************************************************
		//
		// Execute a SqlCommand (that returns a resultset) against the database specified in the connection string 
		// using the provided parameters.
		// 
		// e.g.:  
		//  DataSet ds = ExecuteDataset(connString, CommandType.StoredProcedure, "GetOrders", new SqlParameter("@prodid", 24));
		// 
		// param name="connectionString" a valid connection string for a SqlConnection 
		// param name="commandType" the CommandType (stored procedure, text, etc.) 
		// param name="commandText" the stored procedure name or T-SQL command 
		// param name="commandParameters" an array of SqlParamters used to execute the command 
		// returns a dataset containing the resultset generated by the command
		//
		//*********************************************************************

		public static DataSet ExecuteDataset(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 ExecuteDataset(cn, commandType, commandText, commandParameters);
			}
		}

		//*********************************************************************
		//
		// Execute a stored procedure via a SqlCommand (that returns a 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.
		// 
		// This method provides no access to output parameters or the stored procedure's return value parameter.
		// 
		// e.g.:  
		//  DataSet ds = ExecuteDataset(connString, "GetOrders", 24, 36);
		// 
		// param name="connectionString" a valid connection string for a SqlConnection
		// param name="spName" the name of the stored procedure
		// param name="parameterValues" an array of objects to be assigned as the input values of the stored procedure
		// returns a dataset containing the resultset generated by the command
		//
		//*********************************************************************

		public static DataSet ExecuteDataset(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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美剧在线免费观看网站| 国产麻豆欧美日韩一区| 丝袜诱惑亚洲看片| 国产精品综合一区二区三区| 麻豆精品久久精品色综合| heyzo一本久久综合| 欧美一级午夜免费电影| 91精品国产综合久久婷婷香蕉 | 色综合天天综合给合国产| 欧美一区二区在线视频| 欧美乱妇一区二区三区不卡视频| 337p粉嫩大胆色噜噜噜噜亚洲| 欧美一区二区三区成人| 日韩一区二区精品在线观看| 日韩一级在线观看| 亚洲国产精品久久人人爱| 成人免费福利片| 色综合久久久久综合| 国产日韩欧美精品综合| 精品中文字幕一区二区| 国产不卡视频一区| 精品美女一区二区| 日韩影院免费视频| 555www色欧美视频| av一二三不卡影片| 国产成人免费网站| 九九国产精品视频| 精品一区二区三区在线播放 | 日韩电影免费在线| 蜜桃视频免费观看一区| 看国产成人h片视频| 国精产品一区一区三区mba桃花| 国产麻豆欧美日韩一区| 日韩欧美一区中文| 美女视频黄免费的久久| 加勒比av一区二区| 日韩欧美的一区| 国产精品午夜春色av| 国产成人精品午夜视频免费| 92精品国产成人观看免费| 欧美精品视频www在线观看| 久久伊人蜜桃av一区二区| 中文字幕欧美国产| 成人免费毛片app| 国产精品国产三级国产有无不卡 | 91精品国产手机| 免费观看日韩电影| 国产大陆亚洲精品国产| 日本精品一级二级| 亚洲国产精品视频| 日韩一区二区三免费高清| 国产精品女同一区二区三区| 亚洲一区二区三区精品在线| 精品视频一区二区三区免费| 2021中文字幕一区亚洲| 国产69精品久久99不卡| 欧美精品久久久久久久久老牛影院| 久久久亚洲综合| 粉嫩高潮美女一区二区三区| 中文子幕无线码一区tr| 在线日韩国产精品| 久久九九全国免费| 久久久影视传媒| 99视频精品全部免费在线| 一区二区三区在线免费播放| 国内成人精品2018免费看| 色综合天天性综合| 麻豆精品在线视频| 中文字幕中文字幕中文字幕亚洲无线| 91日韩精品一区| 美女视频网站黄色亚洲| 国产精品不卡视频| 日韩视频免费观看高清完整版在线观看| 中文无字幕一区二区三区| 欧洲精品在线观看| 精品一区二区三区日韩| 欧美一区二区三区四区五区| 成人性色生活片| 久久久99精品免费观看不卡| 色偷偷久久人人79超碰人人澡| 秋霞成人午夜伦在线观看| 中文字幕五月欧美| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 精品一区二区三区在线播放视频 | 久久国产精品99精品国产| 国产精品福利电影一区二区三区四区| 全国精品久久少妇| 欧美一级淫片007| 色激情天天射综合网| 中文字幕一区日韩精品欧美| av一区二区久久| 久久国产精品区| 精品日本一线二线三线不卡| 蜜臀av在线播放一区二区三区| 亚洲视频一区在线| 久久久久久电影| 国产九九视频一区二区三区| 亚洲成人精品一区| 欧美日韩久久久一区| 99久久久精品| 成人永久aaa| 国产精品美女一区二区| 精品91自产拍在线观看一区| 精品一区二区三区视频| 亚洲电影激情视频网站| 亚洲欧美国产高清| 国产精品久久久久久久久搜平片| 精品国产在天天线2019| 成人黄色网址在线观看| 极品少妇xxxx偷拍精品少妇| 免费成人av在线播放| 五月激情综合婷婷| 天天操天天干天天综合网| 欧美一区二区黄| 国产高清久久久久| 亚洲女性喷水在线观看一区| 中文字幕av资源一区| 亚洲精品一线二线三线无人区| 福利91精品一区二区三区| 国内外成人在线视频| 国产伦精一区二区三区| 国内精品写真在线观看| 国产精品一区二区黑丝| 亚洲精品免费电影| 一区二区高清在线| 亚洲成人先锋电影| 麻豆91精品91久久久的内涵| 国产精品青草久久| 亚洲欧美一区二区三区极速播放| 亚洲乱码国产乱码精品精小说 | 91蜜桃视频在线| 青青国产91久久久久久| 国产日韩欧美综合在线| 国产精品私人影院| 亚洲精品视频在线观看网站| 亚洲亚洲精品在线观看| 2021中文字幕一区亚洲| 国产精品久久久久久妇女6080| 欧美午夜宅男影院| 51精品久久久久久久蜜臀| 欧美xingq一区二区| 国产精品伦理一区二区| 亚洲一二三区不卡| 精品一区二区精品| 亚洲午夜电影网| 国产日韩欧美一区二区三区乱码 | 91在线观看免费视频| 美女www一区二区| 国产成人在线看| 欧美日韩精品高清| 久久免费午夜影院| 日韩欧美在线影院| 中文字幕+乱码+中文字幕一区| 亚洲影院在线观看| 国产酒店精品激情| 欧美日韩久久不卡| 国产日韩影视精品| 日韩高清一级片| eeuss鲁片一区二区三区在线看| 欧美日韩一区国产| 色婷婷av一区二区三区软件 | 美女视频一区二区| 秋霞国产午夜精品免费视频| www.66久久| av电影在线观看完整版一区二区| 在线观看视频一区二区| 97精品国产97久久久久久久久久久久| 国产精品一区二区91| 欧美在线一区二区| 欧美探花视频资源| 在线观看三级视频欧美| 99久久久国产精品免费蜜臀| 久久影院午夜片一区| 久久亚洲一区二区三区四区| xf在线a精品一区二区视频网站| 日韩理论电影院| 国产91精品久久久久久久网曝门| 欧美一级电影网站| 日韩一区二区三区免费看| 91精品国产综合久久久蜜臀图片| 中文字幕亚洲一区二区va在线| 国产呦萝稀缺另类资源| 日韩美女一区二区三区四区| 亚洲午夜久久久久久久久电影网 | 欧美一区二区三区四区久久| 欧美日韩国产高清一区二区| 最新国产精品久久精品| 国产美女精品在线| 日韩欧美激情一区| 国产亚洲欧美一级| 美国精品在线观看| 国产丶欧美丶日本不卡视频| 成人av资源在线观看| 欧洲一区二区三区在线| 一区在线中文字幕| gogo大胆日本视频一区| 亚洲视频一二三区| 99国产精品视频免费观看| 国产精品成人免费在线| 亚洲二区在线观看|