本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}