当前位置: 首页>>代码示例>>C#>>正文


C# OracleCommand.CreateParameter方法代码示例

本文整理汇总了C#中System.Data.OracleClient.OracleCommand.CreateParameter方法的典型用法代码示例。如果您正苦于以下问题:C# OracleCommand.CreateParameter方法的具体用法?C# OracleCommand.CreateParameter怎么用?C# OracleCommand.CreateParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.OracleClient.OracleCommand的用法示例。


在下文中一共展示了OracleCommand.CreateParameter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Append

 public void Append(OracleCommand command)
 {
     System.Data.Common.ADP.CheckArgumentNull(command, "command");
     if (System.Data.Common.ADP.IsEmpty(command.CommandText))
     {
         throw System.Data.Common.ADP.CommandTextRequired("Append");
     }
     ICollection parameters = command.Parameters;
     OracleParameter[] array = new OracleParameter[parameters.Count];
     parameters.CopyTo(array, 0);
     string[] parameterNames = new string[array.Length];
     if (0 < array.Length)
     {
         for (int i = 0; i < array.Length; i++)
         {
             parameterNames[i] = array[i].ParameterName;
             OracleParameter destination = command.CreateParameter();
             array[i].CopyTo(destination);
             object obj2 = destination.Value;
             if (obj2 is byte[])
             {
                 byte[] src = (byte[]) obj2;
                 int offset = destination.Offset;
                 int size = destination.Size;
                 int num4 = src.Length - offset;
                 if ((size != 0) && (size < num4))
                 {
                     num4 = size;
                 }
                 byte[] dst = new byte[Math.Max(num4, 0)];
                 Buffer.BlockCopy(src, offset, dst, 0, dst.Length);
                 destination.Offset = 0;
                 destination.Value = dst;
             }
             else if (obj2 is char[])
             {
                 char[] chArray2 = (char[]) obj2;
                 int srcOffset = destination.Offset;
                 int num3 = destination.Size;
                 int num2 = chArray2.Length - srcOffset;
                 if ((num3 != 0) && (num3 < num2))
                 {
                     num2 = num3;
                 }
                 char[] chArray = new char[Math.Max(num2, 0)];
                 Buffer.BlockCopy(chArray2, srcOffset, chArray, 0, chArray.Length * 2);
                 destination.Offset = 0;
                 destination.Value = chArray;
             }
             else if (obj2 is ICloneable)
             {
                 destination.Value = ((ICloneable) obj2).Clone();
             }
             array[i] = destination;
         }
     }
     string statementText = command.StatementText;
     bool isQuery = false;
     LocalParameter[] parameterInsertionPoints = this.ParseText(command, statementText, out isQuery);
     LocalCommand command2 = new LocalCommand(statementText, isQuery, array, parameterNames, parameterInsertionPoints);
     this._dirty = true;
     this.CommandList.Add(command2);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:63,代码来源:OracleCommandSet.cs

示例2: BackIsSelect

 public int BackIsSelect(string strSql, Hashtable ht)
 {
     int num;
     try
     {
         OracleCommand command = new OracleCommand {
             CommandText = strSql,
             Connection = this.con
         };
         OracleParameter parameter = null;
         if (this.st != null)
         {
             command.Transaction = this.st;
         }
         if (ht != null)
         {
             foreach (DictionaryEntry entry in ht)
             {
                 parameter = command.CreateParameter();
                 parameter.ParameterName = entry.Key.ToString();
                 parameter.Value = entry.Value.ToString();
                 command.Parameters.Add(parameter);
             }
         }
         num = int.Parse(command.ExecuteScalar().ToString());
     }
     catch (Exception exception)
     {
         throw exception;
     }
     return num;
 }
开发者ID:SoMeTech,项目名称:SoMeRegulatory,代码行数:32,代码来源:DB_Oracle.cs

示例3: Clone

		public object Clone ()
		{
			// create a new OracleCommand object with the same properties

			OracleCommand cmd = new OracleCommand ();

			cmd.CommandText = this.CommandText;
			cmd.CommandType = this.CommandType;

			// FIXME: not sure if I should set the same object here
			// or get a clone of these too
			cmd.Connection = this.Connection;
			cmd.Transaction = this.Transaction;

			foreach (OracleParameter parm in this.Parameters) {

				OracleParameter newParm = cmd.CreateParameter ();

				newParm.DbType = parm.DbType;
				newParm.Direction = parm.Direction;
				newParm.IsNullable = parm.IsNullable;
				newParm.Offset = parm.Offset;
				newParm.OracleType = parm.OracleType;
				newParm.ParameterName = parm.ParameterName;
				//newParm.Precision = parm.Precision;
				//newParm.Scale = parm.Scale;
				newParm.SourceColumn = parm.SourceColumn;
				newParm.SourceVersion = parm.SourceVersion;
				newParm.Value = parm.Value;

				cmd.Parameters.Add (newParm);
			}

			//cmd.Container = this.Container;
			cmd.DesignTimeVisible = this.DesignTimeVisible;
			//cmd.DesignMode = this.DesignMode;
			cmd.Site = this.Site;
			//cmd.UpdateRowSource = this.UpdateRowSource;

			return cmd;
		}
开发者ID:nlhepler,项目名称:mono,代码行数:41,代码来源:OracleCommand.cs

示例4: SelectString

 public string SelectString(string strSql, Hashtable ht)
 {
     string str;
     try
     {
         OracleCommand command = new OracleCommand {
             CommandText = strSql,
             Connection = this.con
         };
         OracleParameter parameter = null;
         if (this.st != null)
         {
             command.Transaction = this.st;
         }
         if (ht != null)
         {
             foreach (DictionaryEntry entry in ht)
             {
                 parameter = command.CreateParameter();
                 parameter.ParameterName = entry.Key.ToString();
                 parameter.Value = entry.Value.ToString();
                 command.Parameters.Add(parameter);
             }
         }
         string str2 = "";
         object obj2 = command.ExecuteScalar();
         if (obj2 != null)
         {
             str2 = obj2.ToString();
         }
         str = str2;
     }
     catch (Exception exception)
     {
         throw exception;
     }
     return str;
 }
开发者ID:SoMeTech,项目名称:SoMeRegulatory,代码行数:38,代码来源:DB_Oracle.cs


注:本文中的System.Data.OracleClient.OracleCommand.CreateParameter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。