DatabaseCommandHelper

Ecng.Data

Helper methods for creating and working with database command parameters.

方法

CreateDbParameter
public static DbParameter CreateDbParameter(DbProviderFactory factory, string name, ParameterDirection direction, DbType type, object value)
result = DatabaseCommandHelper.CreateDbParameter(factory, name, direction, type, value)

Creates a DbParameter with the specified name, direction, type, and value.

GetValueEx
public static object GetValueEx(DbDataReader reader, int idx)
result = DatabaseCommandHelper.GetValueEx(reader, idx)

Gets the value at the specified column index, returning null for DBNull and normalizing DateTime kinds.

ToDbType
public static DbType ToDbType(Type type)
result = DatabaseCommandHelper.ToDbType(type)

Converts a CLR Type to the corresponding DbType.