Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Barbacan 29 posts 79 karma points
    Jul 30, 2014 @ 22:13
    Barbacan
    0

    Using DateAdd in Where

    Hi! I would get my items with from now till the next fifteen days, so I wrote this:

    var nodes = listaAttivita.Children().Where("dataInizioAttivita <= "+DateTime.Now.AddDays(15)+"").OrderBy("dataInizioAttivita desc");

    where dataInizioAttivita is my DateTime property. This throw a Syntax error exception. Looks fine for me, what's wrong?

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jul 30, 2014 @ 22:40
    Dennis Aaen
    1

    Hi Barbacan,

    I would try to help you the best I can.

    How if you do something like this:

    DateTime days = DateTime.Now.AddDays(15);

    var nodes = listaAttivita.Children().Where("dataInizioAttivita <= @0",days).OrderBy("dataInizioAttivita desc");

    Hope this helps,

    /Dennis

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jul 31, 2014 @ 22:42
    Dennis Aaen
    0

    Hi Barbacan,

    Did you managed to solve your issue, or do you try my solution,

    Looking forward to hear from you.

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft