亚洲欧美第一页_禁久久精品乱码_粉嫩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.
//*********************************************************************

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一区二区三区免费野_久草精品视频
久久久久久久国产精品影院| 亚洲chinese男男1069| 一区二区三区高清在线| 免费成人av资源网| 91久久香蕉国产日韩欧美9色| 精品国产精品网麻豆系列| 亚洲综合成人在线| 97超碰欧美中文字幕| 久久久久国产一区二区三区四区 | 欧美日韩综合不卡| 国产亚洲精品免费| 久久精品av麻豆的观看方式| 欧美撒尿777hd撒尿| 亚洲美女电影在线| 99综合影院在线| 欧美国产国产综合| 国产风韵犹存在线视精品| 日韩欧美电影在线| 毛片一区二区三区| 欧美丰满美乳xxx高潮www| 亚洲综合一区二区精品导航| 91色乱码一区二区三区| 亚洲少妇中出一区| 北条麻妃一区二区三区| 欧美激情一区二区在线| 国产成人aaaa| 国产欧美精品一区二区三区四区| 激情文学综合插| 欧美成人女星排行榜| 另类欧美日韩国产在线| 日韩欧美国产一区二区在线播放| 免费人成黄页网站在线一区二区| 3atv一区二区三区| 麻豆91免费观看| 欧美精品一区二区三区一线天视频| 伦理电影国产精品| 26uuu另类欧美亚洲曰本| 麻豆91精品91久久久的内涵| xfplay精品久久| 韩国v欧美v亚洲v日本v| 国产欧美日韩另类一区| 99免费精品视频| 亚洲精品视频在线| 欧美日韩国产大片| 天天综合日日夜夜精品| 日韩一区二区影院| 精品亚洲国内自在自线福利| 国产精品婷婷午夜在线观看| 91麻豆.com| 日韩黄色片在线观看| 精品国免费一区二区三区| 高清不卡在线观看| 亚洲尤物在线视频观看| 日韩女同互慰一区二区| 成人性生交大合| 亚洲一区二区免费视频| 欧美va在线播放| av一区二区不卡| 亚洲18女电影在线观看| 国产丝袜欧美中文另类| 精品视频免费在线| 国产成人综合在线播放| 夜夜嗨av一区二区三区| 欧美va亚洲va香蕉在线| 色香蕉久久蜜桃| 精品一二三四区| 亚洲激情av在线| 久久久91精品国产一区二区三区| 色婷婷久久一区二区三区麻豆| 琪琪久久久久日韩精品| **欧美大码日韩| 欧美成人艳星乳罩| 在线欧美小视频| 国产91丝袜在线观看| 石原莉奈在线亚洲二区| 亚洲三级理论片| wwwwxxxxx欧美| 9191国产精品| 91在线高清观看| 国产精品99久久久久久久vr | 在线一区二区三区四区五区| 美国毛片一区二区| 亚洲自拍另类综合| 日本一区二区三区四区在线视频| 欧美顶级少妇做爰| 99在线视频精品| 国产精品18久久久久| 免费欧美在线视频| 午夜视频在线观看一区| 自拍偷拍亚洲激情| 亚洲国产精品成人久久综合一区| 日韩午夜在线影院| 91麻豆精品国产91久久久久久 | 亚洲一区二区欧美| 亚洲欧美自拍偷拍| 欧美激情自拍偷拍| 国产亚洲一区二区三区四区| 日韩欧美一区二区视频| 欧美久久久久中文字幕| 在线精品视频免费观看| 99久精品国产| 91丨porny丨国产入口| av成人免费在线| 99久久伊人久久99| a4yy欧美一区二区三区| 成人激情免费视频| 成人av资源站| 99久久亚洲一区二区三区青草| 国产精品99久久久久久似苏梦涵| 精品影视av免费| 国产在线精品免费| 国产一区二区三区在线观看精品| 久久精品国产**网站演员| 麻豆精品在线观看| 国产一区二区在线电影| 国内精品国产三级国产a久久| 久久99精品久久久久婷婷| 国模无码大尺度一区二区三区| 麻豆91在线看| 狠狠色丁香九九婷婷综合五月| 久久国产精品一区二区| 国产一区二区三区在线观看免费视频 | 欧美三级视频在线| 欧美日韩在线亚洲一区蜜芽| 欧美日韩国产免费一区二区| 欧美精品久久天天躁| 欧美老女人第四色| 精品久久久久久久久久久久久久久| 26uuu另类欧美| 最好看的中文字幕久久| 一区二区三区在线影院| 日韩精品午夜视频| 国产精品中文欧美| 91蜜桃免费观看视频| 欧美三级电影一区| 亚洲精品一区二区三区影院| 国产精品污www在线观看| 怡红院av一区二区三区| 免费在线欧美视频| 9色porny自拍视频一区二区| 欧美日韩在线三区| 久久综合久久99| 亚洲女同女同女同女同女同69| 日日摸夜夜添夜夜添精品视频| 国产一区二区三区精品视频| 不卡的av电影| 日韩欧美一二三| 亚洲三级在线播放| 久久99精品国产麻豆不卡| 成人动漫精品一区二区| 91精品国产日韩91久久久久久| 日本一区二区三区久久久久久久久不 | 欧美一个色资源| 中文字幕精品一区二区三区精品| 亚洲精品视频在线观看免费 | 一区二区成人在线观看| 另类小说图片综合网| 91性感美女视频| 久久日韩精品一区二区五区| 亚洲一区欧美一区| 粉嫩高潮美女一区二区三区 | 韩国v欧美v日本v亚洲v| 在线精品视频一区二区三四| 欧美极品少妇xxxxⅹ高跟鞋| 日韩和欧美的一区| 色av综合在线| 中文字幕欧美区| 久久精品国产77777蜜臀| 欧洲一区在线电影| 国产免费观看久久| 精品在线亚洲视频| 91麻豆精品国产自产在线观看一区| 国产精品国产馆在线真实露脸| 精品一区二区三区视频在线观看| 91免费看片在线观看| 久久久精品蜜桃| 久久综合综合久久综合| 欧美乱妇23p| 亚洲一区二区三区免费视频| 91丨porny丨在线| 国产精品久久久久一区| 国产91露脸合集magnet| 久久综合色综合88| 激情综合色综合久久综合| 欧美一级精品大片| 丝袜美腿高跟呻吟高潮一区| 欧美午夜片在线观看| 一级做a爱片久久| 91美女片黄在线观看91美女| 国产精品视频看| 成人av在线网站| 国产精品久线观看视频| 成人性生交大片免费看中文网站| 久久久久久久久97黄色工厂| 久久国产人妖系列| 亚洲精品一区二区三区四区高清 | wwwwww.欧美系列| 国产99久久久国产精品免费看| 久久久综合网站| 国产福利91精品一区二区三区|