I'm evaluating LinqConnect for my company to use in moving an old project to .net core. I'm getting an error on this query
from u in db.user
where u.Created.Value.AddHours(-4) > date.Date
select u.ID
The error is "Line 3: Length or precision specification 0 is invalid."
I ran SQL Server Profiler to capture the SQL being run. It's
exec sp_executesql N'SELECT [t1].[ID]
FROM dbo.[user] [t1]
WHERE DATEADD(ms, (CAST(CONVERT(Float(0,0),@p0 * 3600000) AS Int)) % 86400000, DATEADD(day, (CAST(CONVERT(Float(0,0),@p0 * 3600000) AS Int)) / 86400000, [t1].[Created])) > @p1',N'@p0 float,@p1 datetime',@p0=-4,@p1='2020-07-31 18:18:50.047'
Float(0,0) isn't valid SQL Server syntax, so that's causing the above error. Is this expected behavior, a known error, or is something configured wrong?
SQL Server command trying to use float(0,0)
-
- Posts: 3
- Joined: Fri 31 Jul 2020 19:14
Re: SQL Server command trying to use float(0,0)
Relatedly, a query of the form
db.User.Where(u => u.Created.Value - TimeSpan.FromDays(1)> date)
returns the error
Failed to convert parameter value from a TimeSpan to a DateTimeOffset.
It works under Linq to SQL
db.User.Where(u => u.Created.Value - TimeSpan.FromDays(1)> date)
returns the error
Failed to convert parameter value from a TimeSpan to a DateTimeOffset.
It works under Linq to SQL
Re: SQL Server command trying to use float(0,0)
Thank you for your report. We have reproduced both issues and are investigating them. We will notify you about the result.
-
- Posts: 3
- Joined: Fri 31 Jul 2020 19:14
Re: SQL Server command trying to use float(0,0)
Just curious if there is any update on this, or if you could tell me where there might be one.
Re: SQL Server command trying to use float(0,0)
* The bug with SQL generation of the explicit cast to FLOAT is fixed
* The bug with subtracting a TimeSpan value from the DATETIME column is fixed
We will notify you when the new public build of LinqConnect is available for download.
* The bug with subtracting a TimeSpan value from the DATETIME column is fixed
We will notify you when the new public build of LinqConnect is available for download.
Re: SQL Server command trying to use float(0,0)
New build of LinqConnect 4.9.2067 is available for download now: viewtopic.php?f=31&t=42245.