In dblinq queries, using datetime.now or similar parameters some times
couses error.
if you use
DateTime d = DateTime.Now;
var ids = from i in ctx.Markets
where i.DateScheduled > d
select i.MarketId;
it will works.
Best regards
Sadık Eser
2011/1/9 Magnus Olsson <[email protected]>
> Hello,
>
> I am new to DBlinq and I have a problem and I don't know if it is
> because I'm doing something wrong, if it is because a bug or "not
> implemented" :)
> I am using MySql.
>
> The problem is when I try to use dates in my query.
> The code:
> var ids = from i in ctx.Markets
> where i.DateScheduled > DateTime.Now
> select i.MarketId;
> Console.WriteLine(ids.Count());
>
>
> A MySqlException is thrown:
> "You have an error in your SQL syntax; check the manual that
> corresponds to your MySQL server version for the right syntax to use
> near ':52:15.9545502+01:00)' at line 3"
>
> When I inspect the command it reads like:
> "SELECT COUNT(*)\r\nFROM `MyDatabase`.`Markets`\r\nWHERE
> (`DateScheduled` > 2011-01-09T17:52:15.9545502+01:00)"
>
> As you can see the date parameter seems to lacks the enclosing ''.
> I shouldn't have to do the enclosing myself? If so where would I
> easily do that. If not in which type can I edit so that the value is
> enclosed. (
> I just started using DBLinq and to browse the src-tree so I don't find
> very easily yet :)
>
> Thanks in advance
> /Magnus Olsson
>
> --
> You received this message because you are subscribed to the Google Groups
> "DbLinq" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<dblinq%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/dblinq?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"DbLinq" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/dblinq?hl=en.