Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql.DateDiff 函数出现错误 #1950

Open
929496959 opened this issue Dec 18, 2024 · 1 comment
Open

sql.DateDiff 函数出现错误 #1950

929496959 opened this issue Dec 18, 2024 · 1 comment

Comments

@929496959
Copy link

问题描述及重现代码:

函数报错 KeyNotFoundException: The given key 'dateTimeOffset1' was not present in the dictionary.
反编译发现是函数的参数与表达式取参数不一致导致
使用 ExpiryDate.Value.Subtract(DateTime.Now).Days < passDay 替换方法会导致溢出报错如下
datediff 函数导致溢出。用于分隔两个日期/时间实例的日期部分的数字太大。请尝试使用日期部分精度较低的 datediff
原因是日期中存在 9999-12-31的特殊日期

 FreeSql.SqlExt.DateDiff("dd",DateTime.Now, x.ExpiryDate.Value)< passDay && (x.ExpiryDate != null && x.ExpiryDate.Value.Year >= 2000)

数据库版本

sqlsver 2008 r2

安装的Nuget包

freesql 3.5.102
freesql.provider.sqlserverforsystem 3.5.102

.net framework/. net core? 及具体版本

. net core

@2881099
Copy link
Collaborator

2881099 commented Dec 18, 2024

现在固定 .Subtract 取秒,.Days 再除以的操作

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants