mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-19 07:44:45 +08:00
Sqlsever time(7) to datetime bug
This commit is contained in:
parent
ecf4bf0f72
commit
d8983ce6a7
@ -49,6 +49,8 @@ namespace SqlSugar
|
|||||||
private static readonly MethodInfo getConvertByte = typeof(IDataRecordExtensions).GetMethod("GetConvertByte");
|
private static readonly MethodInfo getConvertByte = typeof(IDataRecordExtensions).GetMethod("GetConvertByte");
|
||||||
private static readonly MethodInfo getConvertChar = typeof(IDataRecordExtensions).GetMethod("GetConvertChar");
|
private static readonly MethodInfo getConvertChar = typeof(IDataRecordExtensions).GetMethod("GetConvertChar");
|
||||||
private static readonly MethodInfo getConvertDateTime = typeof(IDataRecordExtensions).GetMethod("GetConvertDateTime");
|
private static readonly MethodInfo getConvertDateTime = typeof(IDataRecordExtensions).GetMethod("GetConvertDateTime");
|
||||||
|
private static readonly MethodInfo getConvertTime = typeof(IDataRecordExtensions).GetMethod("GetConvertTime");
|
||||||
|
private static readonly MethodInfo getTime = typeof(IDataRecordExtensions).GetMethod("GetTime");
|
||||||
private static readonly MethodInfo getConvertDecimal = typeof(IDataRecordExtensions).GetMethod("GetConvertDecimal");
|
private static readonly MethodInfo getConvertDecimal = typeof(IDataRecordExtensions).GetMethod("GetConvertDecimal");
|
||||||
private static readonly MethodInfo getConvertDouble = typeof(IDataRecordExtensions).GetMethod("GetConvertDouble");
|
private static readonly MethodInfo getConvertDouble = typeof(IDataRecordExtensions).GetMethod("GetConvertDouble");
|
||||||
private static readonly MethodInfo getConvertGuid = typeof(IDataRecordExtensions).GetMethod("GetConvertGuid");
|
private static readonly MethodInfo getConvertGuid = typeof(IDataRecordExtensions).GetMethod("GetConvertGuid");
|
||||||
@ -245,6 +247,8 @@ namespace SqlSugar
|
|||||||
CheckType(bind.DateThrow, bindProperyTypeName, validPropertyName, propertyName);
|
CheckType(bind.DateThrow, bindProperyTypeName, validPropertyName, propertyName);
|
||||||
if (bindProperyTypeName == "datetime")
|
if (bindProperyTypeName == "datetime")
|
||||||
method = isNullableType ? getConvertDateTime : getDateTime;
|
method = isNullableType ? getConvertDateTime : getDateTime;
|
||||||
|
if (bindProperyTypeName == "datetime"&&dbTypeName == "time")
|
||||||
|
method = isNullableType ? getConvertTime : getTime;
|
||||||
break;
|
break;
|
||||||
case CSharpDataType.@decimal:
|
case CSharpDataType.@decimal:
|
||||||
CheckType(bind.DecimalThrow, bindProperyTypeName, validPropertyName, propertyName);
|
CheckType(bind.DecimalThrow, bindProperyTypeName, validPropertyName, propertyName);
|
||||||
|
@ -60,6 +60,19 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
public static DateTime? GetConvertTime(this IDataRecord dr, int i)
|
||||||
|
{
|
||||||
|
var result = dr.GetValue(i);
|
||||||
|
if (result == DBNull.Value)
|
||||||
|
{
|
||||||
|
return null; ;
|
||||||
|
}
|
||||||
|
return Convert.ToDateTime(result.ToString());
|
||||||
|
}
|
||||||
|
public static DateTime GetTime(this IDataRecord dr, int i)
|
||||||
|
{
|
||||||
|
return Convert.ToDateTime(dr.GetValue(i).ToString());
|
||||||
|
}
|
||||||
|
|
||||||
public static decimal? GetConvertDecimal(this IDataRecord dr, int i)
|
public static decimal? GetConvertDecimal(this IDataRecord dr, int i)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user