Backup/DbUtility/OleDbHelper.cs

(开头部分) 65KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/*******************************************************************************
             数据库基类  (OleDB)                                   
             本类主要实现对数据库操作的各种方法              
             本类来源于互联网,大家有更好更新的版本时可以通知我们!!Aosy.net 
             {2013/4/14}                 
 * *****************************************************************************/

using System;
using System.Data;
using System.Xml;
using System.Data.OleDb;
using System.Collections;


namespace PR.DbUtility
{
	/// <summary>
	/// The OleDbHelper class is intended to encapsulate high performance, scalable best practices for 
	/// common uses of OleDbClient.
	/// </summary>
	public sealed class OleDbHelper
	{
		#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 OleDbHelper()".
		private OleDbHelper() {}

		/// <summary>
		/// This method is used to attach array's of OleDbParameters to an OleDbCommand.
		/// 
		/// 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 OleDbParameters tho be added to command</param>
		private static void AttachParameters(OleDbCommand command, OleDbParameter[] commandParameters)
		{
			foreach (OleDbParameter 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 OleDbParameters.
		/// </summary>
		/// <param name="commandParameters">array of OleDbParameters to be assigned values</param>
		/// <param name="parameterValues">array of objects holding the values to be assigned</param>
		private static void AssignParameterValues(OleDbParameter[] commandParameters, object[] parameterValues)
后面还有 1283 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。