System.Linq.Dynamic.ParseException: 'operator' >' with operand type 'DateTime? 'incompatible and 'Int32'


Massimo Variolo

How to parse sdate correctly ?

   IQueryable bddata = Junior2KepwareContext.Set(type)
       .Where($"C_NUMERICID == {idLinea}")
       .Where("C_TIMESTAMP > "+ startDate )
       .OrderBy("C_TIMESTAMP");

System.Linq.Dynamic.ParseException: 'operator' >' with operand type 'DateTime? 'incompatible' and 'Int32'

enter image description here

enter image description here

EVK

You need to use parameters:

IQueryable bddata = Junior2KepwareContext.Set(type)
   .Where($"C_NUMERICID == {idLinea}")
   // @0 is first parameter in the list, @1 is second etc
   .Where("C_TIMESTAMP > @0", startDate) // startDate is of type DateTime, not string
   .OrderBy("C_TIMESTAMP");

It 's a good practice to always use parameters instead of inline values ​​(for example, idLineayou can use it too ).

Related


Dynamic Linq - type is 'Int32? ' method cannot be accessed

Tarun suneja I've been facing a problem since the last three days and couldn't find a solution on Google and stackoverflow. I have a nullable int property in my model. When I try to apply any function on that column using a dynamic where clause, I get an error

Dynamic Linq - type is 'Int32? ' method cannot be accessed

Tarun suneja I've been facing a problem since the last three days and couldn't find a solution on Google and stackoverflow. I have a nullable int property in my model. When I try to apply any function on that column using a dynamic where clause, I get an error

operator operand type mismatch

it tolman kray I have this code snippet fun decrement_to_zero r = if !r < 0 then r := 0 else while !r >= 0 do r := !r - 1 from this tutorial https://learnxinyminutes.com/docs/standard-ml/ But I get this erro

operator operand type mismatch

it tolman kray I have this code snippet fun decrement_to_zero r = if !r < 0 then r := 0 else while !r >= 0 do r := !r - 1 from this tutorial https://learnxinyminutes.com/docs/standard-ml/ But I get this erro

Operand type is incompatible with operator

Noppadet i get error Operand type is incompatible with operator Click OK in the header when trying to compare two "real" data types. Can anyone help me with what problem? public void clicked() { real localAnnualUsage = itemSetup_DS.AnnualUsage();

Incompatible operand types Die and Int

wit Brand new to stackoverflow, please forgive me if I have any mistakes. I'm trying to learn Java right now and I'm having some trouble with the if statement. In the code block below, I get an error: if (die1 == 7) { } Incompatible operand types die and

Dynamic Linq - type is 'Int32? ' method cannot be accessed

Tarun suneja I've been facing a problem since the last three days and couldn't find a solution on Google and stackoverflow. I have a nullable int property in my model. When I try to apply any function on that column using a dynamic where clause, I get an error

Operand type is incompatible with operator

Noppadet i get error Operand type is incompatible with operator Click OK in the header when trying to compare two "real" data types. Can anyone help me with what problem? public void clicked() { real localAnnualUsage = itemSetup_DS.AnnualUsage();