public virtual IDbDataParameter CreateParameter(DbCommand cmd, OnTmsPropertyDescriptor pd, object document) { var p = cmd.CreateParameter(); var piValue = pd.GetValue(document); if (piValue == null || double.NaN.Equals(piValue)) { p.Value = DBNull.Value; } else { p.Value = piValue; } p.ParameterName = GetParameterToken() + pd.FieldName; return(p); }
public override IDbDataParameter CreateParameter(DbCommand cmd, OnTmsPropertyDescriptor pd, object document) { var sqlcmd = cmd as SqlCommand; var p = sqlcmd.CreateParameter(); var piValue = pd.GetValue(document); if (piValue == null || double.NaN.Equals(piValue)) { p.Value = DBNull.Value; } else { p.Value = piValue; } p.ParameterName = GetParameterToken() + pd.FieldName; if (pd.PropertyInfo.PropertyType == typeof(DateTime) || pd.PropertyInfo.PropertyType == typeof(DateTime?)) { p.SqlDbType = SqlDbType.DateTime2; } return(p); }