linq sql peculiarities


i'm encountering peculiarities linq sql.



with comparatively rudimentary query, i wish name fields, nonetheless have date fields formatted strings, i initial achieved this:



        var list = datacontext.mylists.single(x => x.id == myid);

var equipment = i list.myitems
select
new
{
i.id,
i.sector,
i.description,
completedate = i.completedate.hasvalue ? i.completedate.value.toshortdatestring() : "",
duedate = i.duedate.hasvalue ? i.duedate.value.toshortdatestring() : ""
};


later i attempted following query, accurately same, solely i'm querying loyal datacontext, rather an component initial query:



        var equipment = i datacontext.mylists
select
new
{
i.id,
i.sector,
i.description,
completedate = i.completedate.hasvalue ? i.completedate.value.toshortdatestring() : "",
duedate = i.duedate.hasvalue ? i.duedate.value.toshortdatestring() : ""
};


the initial runs fine, nonetheless second query yields a:



could interpret countenance '...' sql provide internal expression.



if i mislay lines format date, works fine. i mislay .hasvalue check also works fine, until there zero values.



any ideas?



anthony



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?