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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? sqlhelper.cs

?? 辦公自動化全套源碼
?? CS
?? 第 1 頁 / 共 2 頁
字號:
				AssignParameterValues(commandParameters, parameterValues);

				//call the overload that takes an array of SqlParameters
				return ExecuteDataset(connectionString, CommandType.StoredProcedure, spName, commandParameters);
			}
				//otherwise we can just call the SP without params
			else 
			{
				return ExecuteDataset(connectionString, CommandType.StoredProcedure, spName);
			}
		}
		
		//*********************************************************************
		//
		// Execute a SqlCommand (that returns a resultset) against the specified SqlConnection 
		// using the provided parameters.
		// 
		// e.g.:  
		//  DataSet ds = ExecuteDataset(conn, CommandType.StoredProcedure, "GetOrders", 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 a dataset containing the resultset generated by the command
		//
		//*********************************************************************

		public static DataSet ExecuteDataset(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);
			
			//create the DataAdapter & DataSet
			SqlDataAdapter da = new SqlDataAdapter(cmd);
			DataSet ds = new DataSet();

			//fill the DataSet using default values for DataTable names, etc.
			da.Fill(ds);
			
			// detach the SqlParameters from the command object, so they can be used again.			
			cmd.Parameters.Clear();
			
			//return the dataset
			return ds;						
		}

		//*********************************************************************
		//
		// Execute a SqlCommand (that returns a 1x1 resultset) against the database specified in the connection string 
		// using the provided parameters.
		// 
		// e.g.:  
		//  int orderCount = (int)ExecuteScalar(connString, CommandType.StoredProcedure, "GetOrderCount", 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 object containing the value in the 1x1 resultset generated by the command
		//
		//*********************************************************************

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

		//*********************************************************************
		//
		// Execute a stored procedure via a SqlCommand (that returns a 1x1 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 orderCount = (int)ExecuteScalar(connString, "GetOrderCount", 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 an object containing the value in the 1x1 resultset generated by the command
		//
		//*********************************************************************

		public static object ExecuteScalar(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 ExecuteScalar(connectionString, CommandType.StoredProcedure, spName, commandParameters);
			}
				//otherwise we can just call the SP without params
			else 
			{
				return ExecuteScalar(connectionString, CommandType.StoredProcedure, spName);
			}
		}

		//*********************************************************************
		//
		// Execute a SqlCommand (that returns a 1x1 resultset) against the specified SqlConnection 
		// using the provided parameters.
		// 
		// e.g.:  
		//  int orderCount = (int)ExecuteScalar(conn, CommandType.StoredProcedure, "GetOrderCount", 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 object containing the value in the 1x1 resultset generated by the command
		//
		//*********************************************************************

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

	//*********************************************************************
	//
	// SqlHelperParameterCache provides functions to leverage a static cache of procedure parameters, and the
	// ability to discover parameters for stored procedures at run-time.
	//
	//*********************************************************************

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

		private SqlHelperParameterCache() {}

		private static Hashtable paramCache = Hashtable.Synchronized(new Hashtable());

		//*********************************************************************
		//
		// resolve at run time the appropriate set of SqlParameters for a stored procedure
		// 
		// param name="connectionString" a valid connection string for a SqlConnection 
		// param name="spName" the name of the stored procedure 
		// param name="includeReturnValueParameter" whether or not to include their return value parameter 
		//
		//*********************************************************************

		private static SqlParameter[] DiscoverSpParameterSet(string connectionString, string spName, bool includeReturnValueParameter)
		{
			using (SqlConnection cn = new SqlConnection(connectionString)) 
			using (SqlCommand cmd = new SqlCommand(spName,cn))
			{
				cn.Open();
				cmd.CommandType = CommandType.StoredProcedure;

				SqlCommandBuilder.DeriveParameters(cmd);

				if (!includeReturnValueParameter) 
				{
					cmd.Parameters.RemoveAt(0);
				}

				SqlParameter[] discoveredParameters = new SqlParameter[cmd.Parameters.Count];;

				cmd.Parameters.CopyTo(discoveredParameters, 0);

				return discoveredParameters;
			}
		}

		private static SqlParameter[] CloneParameters(SqlParameter[] originalParameters)
		{
			//deep copy of cached SqlParameter array
			SqlParameter[] clonedParameters = new SqlParameter[originalParameters.Length];

			for (int i = 0, j = originalParameters.Length; i < j; i++)
			{
				clonedParameters[i] = (SqlParameter)((ICloneable)originalParameters[i]).Clone();
			}

			return clonedParameters;
		}

		//*********************************************************************
		//
		// add parameter array to the cache
		//
		// param name="connectionString" a valid connection string for a SqlConnection 
		// param name="commandText" the stored procedure name or T-SQL command 
		// param name="commandParameters" an array of SqlParamters to be cached 
		//
		//*********************************************************************

		public static void CacheParameterSet(string connectionString, string commandText, params SqlParameter[] commandParameters)
		{
			string hashKey = connectionString + ":" + commandText;

			paramCache[hashKey] = commandParameters;
		}

		//*********************************************************************
		//
		// Retrieve a parameter array from the cache
		// 
		// param name="connectionString" a valid connection string for a SqlConnection 
		// param name="commandText" the stored procedure name or T-SQL command 
		// returns an array of SqlParamters
		//
		//*********************************************************************

		public static SqlParameter[] GetCachedParameterSet(string connectionString, string commandText)
		{
			string hashKey = connectionString + ":" + commandText;

			SqlParameter[] cachedParameters = (SqlParameter[])paramCache[hashKey];
			
			if (cachedParameters == null)
			{			
				return null;
			}
			else
			{
				return CloneParameters(cachedParameters);
			}
		}

		//*********************************************************************
		//
		// Retrieves the set of SqlParameters appropriate for the stored procedure
		// 
		// This method will query the database for this information, and then store it in a cache for future requests.
		// 
		// param name="connectionString" a valid connection string for a SqlConnection 
		// param name="spName" the name of the stored procedure 
		// returns an array of SqlParameters
		//
		//*********************************************************************

		public static SqlParameter[] GetSpParameterSet(string connectionString, string spName)
		{
			return GetSpParameterSet(connectionString, spName, false);
		}

		//*********************************************************************
		//
		// Retrieves the set of SqlParameters appropriate for the stored procedure
		// 
		// This method will query the database for this information, and then store it in a cache for future requests.
		// 
		// param name="connectionString" a valid connection string for a SqlConnection 
		// param name="spName" the name of the stored procedure 
		// param name="includeReturnValueParameter" a bool value indicating whether the return value parameter should be included in the results 
		// returns an array of SqlParameters
		//
		//*********************************************************************

		public static SqlParameter[] GetSpParameterSet(string connectionString, string spName, bool includeReturnValueParameter)
		{
			string hashKey = connectionString + ":" + spName + (includeReturnValueParameter ? ":include ReturnValue Parameter":"");

			SqlParameter[] cachedParameters;
			
			cachedParameters = (SqlParameter[])paramCache[hashKey];

			if (cachedParameters == null)
			{			
				cachedParameters = (SqlParameter[])(paramCache[hashKey] = DiscoverSpParameterSet(connectionString, spName, includeReturnValueParameter));
			}
			
			return CloneParameters(cachedParameters);
		}
	}
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区二区影院| 久久久久国产精品人| 亚洲伦理在线精品| 91浏览器打开| 亚洲尤物视频在线| 91精品国产免费| 久久99精品久久久久婷婷| 337p日本欧洲亚洲大胆色噜噜| 激情小说欧美图片| 欧美激情一区不卡| 在线视频一区二区三区| 亚洲永久免费视频| 91精品国产91久久综合桃花| 视频一区国产视频| 久久免费偷拍视频| 91天堂素人约啪| 亚洲va国产天堂va久久en| 日韩一区二区在线免费观看| 国产成人综合在线观看| 亚洲色图在线播放| 日韩精品中文字幕在线不卡尤物| 国产精品1区二区.| 亚洲午夜激情网页| 国产校园另类小说区| 在线区一区二视频| 国产一区二区成人久久免费影院 | 午夜精品在线看| 日韩精品一区二区三区swag| 国产成人免费高清| 香蕉久久一区二区不卡无毒影院| 亚洲一区二区在线观看视频 | 久久精品人人爽人人爽| 亚洲人成在线播放网站岛国| 久久精品二区亚洲w码| 日本精品视频一区二区| 久久国产精品色婷婷| 国产精品久久国产精麻豆99网站 | 欧美另类z0zxhd电影| 国产成人自拍高清视频在线免费播放| 亚洲一区二区三区中文字幕| 精品黑人一区二区三区久久| 91国模大尺度私拍在线视频| 国产剧情av麻豆香蕉精品| 午夜久久久影院| 亚洲欧美日韩一区二区三区在线观看 | 国产精品亲子乱子伦xxxx裸| 制服丝袜成人动漫| 色综合久久88色综合天天6| 裸体一区二区三区| 亚洲第一电影网| 中文字幕一区在线| 久久精品一区八戒影视| 在线不卡a资源高清| 福利一区福利二区| 国产一区高清在线| 日韩精品久久久久久| 亚洲免费观看高清完整版在线观看| 久久久久久一二三区| 欧美精品精品一区| 国产丝袜欧美中文另类| 在线不卡免费欧美| 欧美视频一区二区三区| 91看片淫黄大片一级在线观看| 国产成人在线免费| 国内精品国产三级国产a久久| 日韩电影在线看| 亚洲不卡一区二区三区| 亚洲另类色综合网站| 亚洲色大成网站www久久九九| 国产欧美日本一区二区三区| 精品久久久久av影院| 日韩免费电影一区| 337p日本欧洲亚洲大胆色噜噜| 精品美女被调教视频大全网站| 日韩情涩欧美日韩视频| 欧美一区二区观看视频| 欧美一区二区三区精品| 91精品国产91久久久久久一区二区| 欧美三级一区二区| 欧美日韩第一区日日骚| 欧美日韩久久一区二区| 欧美裸体bbwbbwbbw| 91精品国产91久久久久久最新毛片| 91麻豆精品国产无毒不卡在线观看 | 1区2区3区精品视频| **网站欧美大片在线观看| 1000精品久久久久久久久| 亚洲特级片在线| 亚洲男人电影天堂| 亚洲动漫第一页| 日本系列欧美系列| 国产精品一线二线三线精华| 丁香婷婷深情五月亚洲| 精品国产三级电影在线观看| 欧美精品一区二区三区在线| 国产欧美精品国产国产专区| 亚洲欧洲精品一区二区精品久久久 | 日韩一二三区不卡| 久久嫩草精品久久久精品一| 中文字幕不卡在线| 亚洲mv在线观看| 国产福利一区二区三区视频| 99久久伊人精品| 欧美剧情片在线观看| 久久丝袜美腿综合| 一区二区三区在线视频播放| 日韩精品乱码av一区二区| 国产福利一区二区三区| 在线视频一区二区免费| 日韩精品一区二区三区视频在线观看| 欧美激情中文不卡| 亚洲国产成人高清精品| 极品少妇一区二区| 91麻豆国产自产在线观看| 欧美一区二区在线视频| 国产精品热久久久久夜色精品三区 | 国产精品每日更新| 亚洲午夜久久久久| 成人一级黄色片| 欧美久久久久免费| 中文字幕一区二区三区在线观看| 亚洲国产成人高清精品| 国产91精品在线观看| 欧美日韩亚洲综合在线 欧美亚洲特黄一级| 欧美成人性福生活免费看| 亚洲免费在线观看| 国产电影一区在线| 日韩一级片在线观看| 亚洲色图欧美激情| 国产精品一线二线三线精华| 欧美美女网站色| 一区二区三区欧美亚洲| 国产成人av电影免费在线观看| 欧美精品久久久久久久久老牛影院| 国产精品久久看| 国产九色精品成人porny | 精品免费日韩av| 亚洲成人黄色小说| 色妹子一区二区| 国产女同性恋一区二区| 蜜臀久久久99精品久久久久久| 欧美在线三级电影| 国产精品第四页| 成人在线视频首页| 久久久久久久久久久久久久久99| 日韩在线一区二区| 欧美伊人久久久久久久久影院 | 国v精品久久久网| 日韩欧美中文字幕一区| 亚洲综合一区二区精品导航| bt欧美亚洲午夜电影天堂| 国产性天天综合网| 国模冰冰炮一区二区| 日韩欧美成人一区| 久久精品久久久精品美女| 欧美日韩二区三区| 天天色图综合网| 欧美日韩一区国产| 亚洲国产精品一区二区www| 97久久精品人人做人人爽| 国产精品灌醉下药二区| 国产成人精品免费看| 国产网红主播福利一区二区| 国产一区二区按摩在线观看| 久久亚洲欧美国产精品乐播| 国产在线乱码一区二区三区| 精品国产凹凸成av人导航| 丰满放荡岳乱妇91ww| 久久久久99精品一区| 国产乱一区二区| 中文字幕欧美区| 99视频有精品| 亚洲蜜臀av乱码久久精品| 色综合久久88色综合天天| 亚洲综合小说图片| 欧美妇女性影城| 美女精品一区二区| 久久色视频免费观看| 成人永久看片免费视频天堂| 国产精品成人一区二区艾草| 一本到不卡精品视频在线观看| 亚洲你懂的在线视频| 欧美日韩视频在线一区二区| 奇米综合一区二区三区精品视频| 日韩你懂的在线播放| 国产成人亚洲综合a∨婷婷图片 | 一区二区三区免费| 欧美日韩国产一区| 久久av中文字幕片| 国产日韩欧美激情| 在线观看欧美精品| 免费观看成人鲁鲁鲁鲁鲁视频| 26uuu亚洲综合色欧美| 成人激情图片网| 亚洲国产精品久久人人爱蜜臀| 欧美一区二区三区免费大片| 国产老妇另类xxxxx| 亚洲日本青草视频在线怡红院| 欧美三级乱人伦电影| 久久国产婷婷国产香蕉|