本文整理汇总了C#中DbType.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# DbType.Equals方法的具体用法?C# DbType.Equals怎么用?C# DbType.Equals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DbType
的用法示例。
在下文中一共展示了DbType.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConfigureParameter
/// <summary>
/// 生成一个Parameter对象
/// </summary>
/// <param name="parameter"></param>
/// <param name="parameterName"></param>
/// <param name="dbType"></param>
/// <param name="size"></param>
/// <param name="direction"></param>
/// <param name="nullable"></param>
/// <param name="sourceColumn"></param>
/// <remarks>
/// 面向批量处理增加的方法
/// added by wangxiang . May 21, 2008
/// </remarks>
protected override void ConfigureParameter(DbParameter parameter,
string parameterName,
DbType dbType,
int size,
ParameterDirection direction,
bool nullable,
string sourceColumn)
{
SqlParameter param = parameter as SqlParameter;
param.ParameterName = parameterName;
if (dbType.Equals(DbType.Object))
{
param.SqlDbType = SqlDbType.Image;
}
else
{
param.DbType = dbType;
}
param.Size = size;
param.Direction = direction;
param.IsNullable = nullable;
param.SourceColumn = sourceColumn;
}
示例2: CreateParameter
/// <devdoc>
/// Create a parameter.
/// </devdoc>
private SqlParameter CreateParameter(string name, DbType type, int size, ParameterDirection direction, bool nullable, byte precision, byte scale, string sourceColumn, DataRowVersion sourceVersion, object value)
{
SqlParameter param = this.command.CreateParameter();
param.ParameterName = BuildParameterName(name);
if ((type.Equals(DbType.Object)) && (value is byte[]))
{
param.SqlDbType = SqlDbType.Image;
}
else
{
param.DbType = type;
}
param.Size = size;
param.Direction = direction;
param.IsNullable = nullable;
param.Precision = precision;
param.Scale = scale;
param.SourceColumn = sourceColumn;
param.SourceVersion = sourceVersion;
param.Value = (value == null) ? DBNull.Value : value;
return param;
}