本文整理汇总了C#中ParameterDirection类的典型用法代码示例。如果您正苦于以下问题:C# ParameterDirection类的具体用法?C# ParameterDirection怎么用?C# ParameterDirection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParameterDirection类属于命名空间,在下文中一共展示了ParameterDirection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddSqlParameter
/// <summary>
/// SQLのパラメータを追加します。サニタイジング(SQLインジェクション対策)をします
/// </summary>
/// <param name="cmd"></param>
/// <param name="direction"></param>
/// <param name="paramName"></param>
/// <param name="type"></param>
/// <param name="value">値がnullの場合はDBNull.Valueを挿入します</param>
public static void AddSqlParameter(SqlCommand cmd, ParameterDirection direction, string paramName, SqlDbType type, Object value)
{
if (cmd == null)
{
return;
}
if (string.IsNullOrEmpty(paramName) || string.IsNullOrWhiteSpace(paramName))
{
return;
}
if (value == null)
{
value = DBNull.Value;
}
SqlParameter param = cmd.CreateParameter();
param.ParameterName = paramName;
param.SqlDbType = type;
param.Direction = direction;
param.Value = value;
cmd.Parameters.Add(param);
}
示例2: MySqlParameter
internal MySqlParameter(string name, GodLesZ.Library.MySql.Data.MySqlClient.MySqlDbType type, ParameterDirection dir, string col, DataRowVersion ver, object val)
: this(name, type) {
this.direction = dir;
this.sourceColumn = col;
this.sourceVersion = ver;
this.Value = val;
}
示例3: AddParameter
public virtual DbParameter AddParameter(DbCommand dm, string name, DbType dbType, int size,
ParameterDirection direction, bool nullable, byte precision, byte scale, string sourceColumn,
DataRowVersion sourceVersion, object value)
{
////if (dbType == DbType.String)
//// throw new Exception("请不要使用DbType.String进行数据库查询!");
if (CheckInjectAttackForSp(dm, value))
throw new Exception("输入的部分内容可能对系统稳定性造成影响,操作已停止![" + value + "]");
DbParameter param = this.ProviderFactory.CreateParameter();
if (param != null)
{
param.ParameterName = name;
param.DbType = dbType;
param.Size = size;
param.Value = value ?? DBNull.Value;
param.Direction = direction;
param.IsNullable = nullable;
param.SourceColumn = sourceColumn;
param.SourceVersion = sourceVersion;
dm.Parameters.Add(param);
}
return param;
}
示例4: Parameters
public Parameters(string Name, object Value,DbType dbType)
{
ParamName = Name;
ParamValue = Value;
ParamDbType = dbType;
ParamDirection = ParameterDirection.Input;
}
示例5: Add
public override void Add(string name, object value = null, DbGenericType? dbType = null, ParameterDirection? direction = null, int? size = null)
{
if (value is bool)
value = (bool)value ? 1 : 0; //Oracle doesn't like BOOL.
base.Add(name, value, dbType, direction, size);
}
示例6: CreateParameter
public DbParameter CreateParameter(Type connectionType, string sourceColumn, ParameterDirection parameterDirection, DbType parameterDbType, int parameterSize, byte parameterPrecision, byte parameterScale, bool parameterNullable, string parameterName, object parameterValue)
{
DbParameter dbParameter;
if ((object)connectionType == null)
throw new ArgumentNullException(nameof(connectionType));
using (DbConnection dbConnection = (DbConnection)Activator.CreateInstance(connectionType))
{
using (DbCommand dbCommand = dbConnection.CreateCommand())
dbParameter = dbCommand.CreateParameter();
dbParameter.ParameterName = parameterName;
dbParameter.Size = parameterSize;
dbParameter.Value = parameterValue;
dbParameter.Direction = parameterDirection;
dbParameter.DbType = parameterDbType;
this.ReflectionFascade.SetLogicalPropertyValue(dbParameter, "IsNullable", parameterNullable, true, false);
dbParameter.Precision = parameterPrecision;
dbParameter.Scale = parameterScale;
dbParameter.SourceColumn = sourceColumn;
return dbParameter;
}
}
示例7: Add
/// <summary>
/// ref�ν� SqlParameter[]�� �Ƽ� ���ο� SqlParameter �� ���� Array�� �߰��Ѵ�.
/// </summary>
/// <param name="paramArray">������ SqlParameter[]</param>
/// <param name="parameterName">���Ӱ� �����ϰ��� �ϴ� SqlParamter �� ����� �̸�</param>
/// <param name="paramValue">���Ӱ� �����ϰ��� �ϴ� SqlParamter �� ����� ��</param>
/// <param name="direction">SqlParameter�� ��� �Ӽ�����</param>
public static void Add( ref SqlParameter[] paramArray, string parameterName, object paramValue, ParameterDirection direction )
{
SqlParameter parameter = new SqlParameter(parameterName, paramValue);
parameter.Direction = direction;
Add(ref paramArray, parameter);
}
示例8: Add
public IDbDataParameter Add(string paramName, Enum paramType, int paramSize, ParameterDirection paramDirection, byte precision, byte scale, string sourceColumn, object paramValue)
{
IDbDataParameter param = _command.CreateParameter();
param.ParameterName = paramName;
if(paramType is DbType)
{
param.DbType = (DbType)paramType;
}
param.Direction = paramDirection;
if(sourceColumn != null && sourceColumn != string.Empty)
param.SourceColumn = sourceColumn;
if(paramSize > 0)
param.Size = paramSize;
if(precision > 0)
param.Precision = precision;
if(scale > 0)
param.Scale = scale;
if(paramValue != null && param.Value != DBNull.Value)
param.Value = paramValue;
_parameters.Add(param);
return param;
}
示例9: DBParameter
/// <summary>
/// Creates a parameter with the name, value, data type and direction specified.
/// </summary>
/// <param name="name">Parameter name</param>
/// <param name="value">Value associated with the parameter</param>
/// <param name="dbType">Data type</param>
/// <param name="paramDirection">Parameter direction</param>
public DBParameter(string name, object value, DbType dbType, ParameterDirection paramDirection)
{
_name = name;
_value = value;
_type = dbType;
_paramDirection = paramDirection;
}
示例10: DefineParameter
public override DbParameter DefineParameter(string parameterName, DbType dbType, ParameterDirection direction)
{
SqlCommand sqlCmd = (SqlCommand)base.DbCommand;
SqlParameter sqlParm = sqlCmd.Parameters.Add(parameterName, (SqlDbType)SqlDbTypeMap[(int)dbType].ProviderDbType);
sqlParm.Direction = direction;
return sqlParm;
}
示例11: RoutineParameter
public RoutineParameter(string name, SqlType type, ParameterDirection direction, ParameterAttributes attributes)
{
Attributes = attributes;
Direction = direction;
Type = type;
Name = name;
}
示例12: AddSqlPrameter
//thoai Add sql parameter
protected static SqlParameter AddSqlPrameter(string parameterName, SqlDbType dbType, int size, ParameterDirection direction, object value)
{
SqlParameter parameter = new SqlParameter(parameterName, dbType, size);
parameter.Direction = direction;
parameter.Value = value;
return parameter;
}
示例13: CreateParameter
/// <summary>
/// 매개 변수를 사용하여 <c>SqlParameter</c>클래스의 새 인스턴스를 반환합니다.
/// </summary>
/// <param name="parameterName">매핑할 매개 변수의 이름</param>
/// <param name="dbType"><c>SqlDbType</c>값 중 하나</param>
/// <param name="size">매개 변수의 길이</param>
/// <param name="direction"><c>ParameterDirection</c>값 중 하나</param>
/// <returns><c>SqlParameter</c>클래스의 새 인스턴스</returns>
public static SqlParameter CreateParameter(string parameterName, SqlDbType dbType, int size, ParameterDirection direction)
{
SqlParameter ret = CreateParameter(parameterName, dbType);
ret.Direction = direction;
ret.Size = size;
return ret;
}
示例14: AddParameter
public static IDbCommand AddParameter(this IDbCommand command, string name, DbType type, object value, int size, ParameterDirection direction)
{
var parameter = command.NewParameter(name, type, direction, value, size);
command.Parameters.Add(parameter);
return command;
}
示例15: CreateParameter
public static DbParameter CreateParameter(string name, DbType type, ParameterDirection direction)
{
SqlParameter parameter = CreateParameter(name);
parameter.DbType = type;
parameter.Direction = direction;
return parameter;
}