diff --git a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataReaderEntityBuilder.cs b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataReaderEntityBuilder.cs index 381a606c7..888945f1c 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataReaderEntityBuilder.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataReaderEntityBuilder.cs @@ -217,6 +217,10 @@ namespace SqlSugar { method = isNullableType ? getConvertByte : getByte; } + else if (bindPropertyType == UtilConstants.StringType&&dbTypeName?.ToLower()== "timestamp") + { + method = getConvertValueMethod.MakeGenericMethod(columnInfo.PropertyInfo.PropertyType); ; + } else if (bindPropertyType == UtilConstants.StringType) { method = getString; diff --git a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs index 7130eee92..003c4dff1 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/DbBindProvider/IDataRecordExtensions.cs @@ -138,12 +138,23 @@ namespace SqlSugar } public static T GetConvertValue(this IDataRecord dr, int i) { - if (dr.IsDBNull(i)) + try { - return default(T); + if (dr.IsDBNull(i)) + { + return default(T); + } + var result = dr.GetValue(i); + return UtilMethods.To(result); + } + catch (Exception ex) + { + if (dr.GetFieldType(i) == UtilConstants.DateType) + { + return UtilMethods.To(dr.GetConvertDouble(i)); + } + throw new Exception(ex.Message); } - var result = dr.GetValue(i); - return UtilMethods.To(result); } public static long? GetConvetInt64(this IDataRecord dr, int i)